services: fix seg. fault issue 00/313700/1
authorInki Dae <inki.dae@samsung.com>
Mon, 1 Jul 2024 05:58:30 +0000 (14:58 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 1 Jul 2024 06:06:53 +0000 (15:06 +0900)
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 <inki.dae@samsung.com>
services/auto_zoom/src/AutoZoom.cpp
services/common/include/AsyncManager.h

index bf9a2f620ca89286f7452b567016c564d6ecef35..35ac12a3d95780e361627b6140dbc202d0d670d5 100644 (file)
@@ -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();
 }
index ee32192b244fe6dde4827b898cc108c641b09f58..329732355c802368da7452a9986ba1721aec0bc3 100644 (file)
@@ -117,7 +117,9 @@ public:
                _thread_handle = std::make_unique<std::thread>(&AsyncManager::invokeThread, this);
        }
 
-       ~AsyncManager()
+       ~AsyncManager() = default;
+
+       void destroy()
        {
                _exit_thread = true;
                _thread_handle->join();