[libcamera-devel] [PATCH] libcamera: camera_manager: Protect cameras_ by mutex in cleanup()
Umang Jain
umang.jain at ideasonboard.com
Mon Jun 20 07:58:09 CEST 2022
From: Hirokazu Honda <hiroh at chromium.org>
CameraManager::Private::cleanup() accesses cameras_ without acquiring
mutex_. Fix it.
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
---
src/libcamera/camera_manager.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 70d73822..4492edc3 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -178,7 +178,10 @@ void CameraManager::Private::cleanup()
* process deletion requests from the thread's message queue as the event
* loop is not in action here.
*/
+ mutex_.lock();
cameras_.clear();
+ mutex_.unlock();
+
dispatchMessages(Message::Type::DeferredDelete);
enumerator_.reset(nullptr);
--
2.31.1
More information about the libcamera-devel
mailing list