wait to closeEvent on monitor shutdown

This commit is contained in:
Isaac Connor 2018-03-28 14:03:56 -04:00
parent 4be64152e8
commit b22911f554
1 changed files with 7 additions and 5 deletions

View File

@ -620,11 +620,6 @@ Debug(3, "Success connecting");
}
Monitor::~Monitor() {
if ( event_delete_thread ) {
event_delete_thread->join();
delete event_delete_thread;
event_delete_thread = NULL;
}
if ( timestamps ) {
delete[] timestamps;
timestamps = 0;
@ -641,6 +636,13 @@ Monitor::~Monitor() {
if ( event ) {
Info( "%s: image_count:%d - Closing event %d, shutting down", name, image_count, event->Id() );
closeEvent();
// closeEvent may start another thread to close the event, so wait for it to finish
if ( event_delete_thread ) {
event_delete_thread->join();
delete event_delete_thread;
event_delete_thread = NULL;
}
}
if ( (deinterlacing & 0xff) == 4) {