From 46d544345cbae270da533a737e334880720ceea5 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Tue, 2 Jun 2020 11:15:37 +0900 Subject: libcamera: IPAManager: make IPAManager lifetime explicitly managed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If any ipa_context instances are destroyed after the IPAManager is destroyed, then a segfault will occur, since the modules have been unloaded by the IPAManager and the context function pointers have been freed. Fix this by making the lifetime of the IPAManager explicit, and make the CameraManager construct and deconstruct (automatically, via a unique pointer) the IPAManager. Also update the IPA interface test to do the construction and deconstruction of the IPAManager, as it does not use the CameraManager. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/camera_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libcamera/camera_manager.cpp') diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 849377ad..da806fa7 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -15,6 +15,7 @@ #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/event_dispatcher_poll.h" +#include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" #include "libcamera/internal/thread.h" @@ -63,6 +64,8 @@ private: std::vector> pipes_; std::unique_ptr enumerator_; + + IPAManager ipaManager_; }; CameraManager::Private::Private(CameraManager *cm) -- cgit v1.2.1