From: Inki Dae Date: Mon, 1 Jul 2024 05:58:30 +0000 (+0900) Subject: services: fix seg. fault issue X-Git-Tag: accepted/tizen/unified/20240903.110722~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F313700%2F1;p=platform%2Fcore%2Fapi%2Fsingleo.git services: fix seg. fault issue Fix seg. fault issue. The issue happened because invokeThread() callback of AsyncManager class was called after camera service had been terminated, which in turn, the callback of branch node tried to access invalid buffer. So this patch makes sure to wait for the completion of AsyncManager's thread after the camera service is off. Change-Id: Ic64f2fd88f880b2eab9ec26b58cc7252bfb16930 Signed-off-by: Inki Dae --- diff --git a/services/auto_zoom/src/AutoZoom.cpp b/services/auto_zoom/src/AutoZoom.cpp index bf9a2f6..35ac12a 100644 --- a/services/auto_zoom/src/AutoZoom.cpp +++ b/services/auto_zoom/src/AutoZoom.cpp @@ -145,8 +145,10 @@ void AutoZoom::configure(InputConfigBase &config) AutoZoom::~AutoZoom() { - if (_async_mode) + if (_async_mode) { _input_service->streamOff(); + _async_manager->destroy(); + } _taskManager->clear(); } diff --git a/services/common/include/AsyncManager.h b/services/common/include/AsyncManager.h index ee32192..3297323 100644 --- a/services/common/include/AsyncManager.h +++ b/services/common/include/AsyncManager.h @@ -117,7 +117,9 @@ public: _thread_handle = std::make_unique(&AsyncManager::invokeThread, this); } - ~AsyncManager() + ~AsyncManager() = default; + + void destroy() { _exit_thread = true; _thread_handle->join();