From b566e97aacd4d4c023526671bafc371ed2eca2c3 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Aug 2019 15:46:59 +0300 Subject: libcamera: camera_manager: Bind CameraManager to threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CameraManager class uses the event dispatcher of the current thread. This makes the CameraManager::eventDispatcher() and CameraManager::setEventDispatcher() methods inconsistent, as they access different event dispatcher instances depending on the calling thread. Fix this by inheriting from the Object class, which binds the CameraManager to a thread, and use the event dispatcher of the bound thread. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- src/libcamera/camera_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcamera/camera_manager.cpp') diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 2cf01423..4a880684 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -248,7 +248,7 @@ CameraManager *CameraManager::instance() */ void CameraManager::setEventDispatcher(std::unique_ptr dispatcher) { - Thread::current()->setEventDispatcher(std::move(dispatcher)); + thread()->setEventDispatcher(std::move(dispatcher)); } /** @@ -264,7 +264,7 @@ void CameraManager::setEventDispatcher(std::unique_ptr dispatch */ EventDispatcher *CameraManager::eventDispatcher() { - return Thread::current()->eventDispatcher(); + return thread()->eventDispatcher(); } } /* namespace libcamera */ -- cgit v1.2.1