From 1563ffd0d2f1b421e960744331752ddac3c8c693 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Mon, 1 Jul 2024 14:58:30 +0900 Subject: [PATCH] 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 --- services/auto_zoom/src/AutoZoom.cpp | 4 +++- services/common/include/AsyncManager.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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(); -- 2.34.1