From dc975daa7a316f57157c124c906d968ebe331b5f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 8 Jan 2022 12:21:29 -0500 Subject: [PATCH] init soap to null in constructor. Stop analysis thread before destroying soap. --- src/zm_monitor.cpp | 15 +++++++-------- src/zm_monitor.h | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 8bb5b2a29..a29e42c30 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -423,7 +423,8 @@ Monitor::Monitor() green_val(0), blue_val(0), grayscale_val(0), - colour_val(0) + colour_val(0), + soap(nullptr) { if ( strcmp(config.event_close_mode, "time") == 0 ) @@ -1808,8 +1809,6 @@ bool Monitor::Poll() { return TRUE; } //end Poll - - // Would be nice if this JUST did analysis // This idea is that we should be analysing as close to the capture frame as possible. // This function should process as much as possible before returning @@ -3158,13 +3157,16 @@ int Monitor::Close() { if (decoder) { decoder->Stop(); } + if (analysis_thread) { + analysis_thread->Stop(); + } #ifdef WITH_GSOAP //ONVIF Teardown if (Poller) { Poller->Stop(); } - if (onvif_event_listener && soap != nullptr) { + if (onvif_event_listener && (soap != nullptr)) { Debug(1, "Tearing Down Onvif"); _wsnt__Unsubscribe wsnt__Unsubscribe; _wsnt__UnsubscribeResponse wsnt__UnsubscribeResponse; @@ -3173,12 +3175,9 @@ int Monitor::Close() { soap_end(soap); soap_free(soap); soap = nullptr; - }//End ONVIF + } //End ONVIF #endif - if (analysis_thread) { - analysis_thread->Stop(); - } packetqueue.clear(); if (audio_fifo) { delete audio_fifo; diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 99390ef92..fe67b6f3b 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -256,18 +256,6 @@ protected: protected: - //ONVIF -#ifdef WITH_GSOAP - struct soap *soap; - bool ONVIF_Trigger_State; - bool ONVIF_Healthy; - _tev__CreatePullPointSubscription request; - _tev__CreatePullPointSubscriptionResponse response; - _tev__PullMessages tev__PullMessages; - _tev__PullMessagesResponse tev__PullMessagesResponse; - PullPointSubscriptionBindingProxy proxyEvent; - void set_credentials(struct soap *soap); -#endif // These are read from the DB and thereafter remain unchanged unsigned int id; @@ -451,6 +439,18 @@ protected: Rgb colour_val; /* RGB32 color */ int usedsubpixorder; + //ONVIF +#ifdef WITH_GSOAP + struct soap *soap; + bool ONVIF_Trigger_State; + bool ONVIF_Healthy; + _tev__CreatePullPointSubscription request; + _tev__CreatePullPointSubscriptionResponse response; + _tev__PullMessages tev__PullMessages; + _tev__PullMessagesResponse tev__PullMessagesResponse; + PullPointSubscriptionBindingProxy proxyEvent; + void set_credentials(struct soap *soap); +#endif public: explicit Monitor();