libcamera: ProcessManager: make ProcessManager lifetime explicitly managed

If any Process instances are destroyed after the ProcessManager is
destroyed, then a segfault will occur.

Fix this by making the lifetime of the ProcessManager explicit, and make
the CameraManager construct and deconstruct (automatically, via a member
variable) the ProcessManager.

Update the tests accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Paul Elder
2020-10-07 19:17:31 +09:00
parent 7e59bccb35
commit 1469d5e26e
5 changed files with 54 additions and 27 deletions
+2
View File
@@ -18,6 +18,7 @@
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/log.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/process.h"
#include "libcamera/internal/thread.h"
#include "libcamera/internal/utils.h"
@@ -67,6 +68,7 @@ private:
std::unique_ptr<DeviceEnumerator> enumerator_;
IPAManager ipaManager_;
ProcessManager processManager_;
};
CameraManager::Private::Private(CameraManager *cm)