Delete event data in event class, not in plugin function

This commit is contained in:
Emmanuel Papin 2015-03-07 14:42:01 +01:00
parent 40c3ba1ed3
commit a4e4db31bc
3 changed files with 17 additions and 2 deletions

View File

@ -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];

View File

@ -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 )

View File

@ -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 );