Delete event data in event class, not in plugin function
This commit is contained in:
parent
40c3ba1ed3
commit
a4e4db31bc
|
@ -227,8 +227,17 @@ void Event::AddCause( const std::string new_cause )
|
|||
}
|
||||
}
|
||||
|
||||
void Event::Close()
|
||||
{
|
||||
if ( ( tot_score == 0 ) && ( alarm_frames == 0 ) )
|
||||
{
|
||||
Info( "Event is empty: Delete data" );
|
||||
DeleteData();
|
||||
}
|
||||
}
|
||||
|
||||
// This is the transcription of JavaScript function DeleteEvent()
|
||||
void Event::DeleteEvent()
|
||||
void Event::DeleteData()
|
||||
{
|
||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
|
||||
|
|
|
@ -133,10 +133,11 @@ public:
|
|||
void AddFrames( int n_frames, Image **images, struct timeval **timestamps );
|
||||
void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL );
|
||||
void AddCause( const std::string new_cause );
|
||||
void DeleteEvent();
|
||||
void Close();
|
||||
|
||||
private:
|
||||
void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps );
|
||||
void DeleteData();
|
||||
|
||||
public:
|
||||
static const char *getSubPath( struct tm *time )
|
||||
|
|
|
@ -3117,10 +3117,15 @@ bool Monitor::closeEvent()
|
|||
{
|
||||
gettimeofday( &(event->EndTime()), NULL );
|
||||
}
|
||||
|
||||
// Inform all plugins that we are closing the event
|
||||
if ( config.load_plugins && ( purpose == ANALYSIS ) )
|
||||
{
|
||||
ThePluginManager.getImageAnalyser().onCloseEvent( zones, event );
|
||||
}
|
||||
|
||||
event->Close();
|
||||
|
||||
delete event;
|
||||
event = 0;
|
||||
return( true );
|
||||
|
|
Loading…
Reference in New Issue