[libcamera-devel] [PATCH 4/7] libcamera: camera_manager: Protect cameras_ by mutex in cleanup()
Hirokazu Honda
hiroh at chromium.org
Fri Dec 3 17:46:16 CET 2021
This fixes the bug that camera_ is accessed without acquiring
mutex_ in CameraManager::Private::cleanup().
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
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.34.0.384.gca35af8252-goog
More information about the libcamera-devel
mailing list