From 86d424baf02cf9d98af5025a2d4e11d75534ec58 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 19 Feb 2021 20:42:36 -0500 Subject: [PATCH] Move closeEvent to Close(). If we are closing the camera, we have to close the event as well. --- src/zm_monitor.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index bb867ebba..c75d5329a 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1071,11 +1071,6 @@ Monitor::~Monitor() { Close(); if (mem_ptr != nullptr) { - std::lock_guard lck(event_mutex); - if (event) { - Info("%s: image_count:%d - Closing event %" PRIu64 ", shutting down", name, image_count, event->Id()); - closeEvent(); - } if (purpose != QUERY) { shared_data->state = state = IDLE; shared_data->last_read_index = image_buffer_count; @@ -2923,10 +2918,16 @@ int Monitor::PrimeCapture() { int Monitor::PreCapture() const { return camera->PreCapture(); } int Monitor::PostCapture() const { return camera->PostCapture(); } int Monitor::Close() { + std::lock_guard lck(event_mutex); + if (event) { + Info("%s: image_count:%d - Closing event %" PRIu64 ", shutting down", name, image_count, event->Id()); + closeEvent(); + } if (camera) camera->Close(); packetqueue.clear(); return 1; } + Monitor::Orientation Monitor::getOrientation() const { return orientation; } // Wait for camera to get an image, and then assign it as the base reference image.