summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp2
-rw-r--r--src/libcamera/camera_manager.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 69a1b442..034f341d 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -464,7 +464,7 @@ std::shared_ptr<Camera> Camera::create(PipelineHandler *pipe,
struct Deleter : std::default_delete<Camera> {
void operator()(Camera *camera)
{
- delete camera;
+ camera->deleteLater();
}
};
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index f60491d2..c45bf33f 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -164,9 +164,13 @@ void CameraManager::Private::cleanup()
/*
* Release all references to cameras to ensure they all get destroyed
- * before the device enumerator deletes the media devices.
+ * before the device enumerator deletes the media devices. Cameras are
+ * destroyed via Object::deleteLater() API, hence we need to explicitly
+ * process deletion requests from the thread's message queue as the event
+ * loop is not in action here.
*/
cameras_.clear();
+ dispatchMessages(Message::Type::DeferredDelete);
enumerator_.reset(nullptr);
}