diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-04 10:20:50 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-07 20:24:31 +0200 |
commit | fa63d428aef62bacf0a6ad1622a7965b3ff2ba2f (patch) | |
tree | 676330d05d77fecdf73be0cb266d1ea5054ed341 /src/gstreamer/gstlibcamerasrc.cpp | |
parent | b394dc8b8001dd702dfa171a123f4e33c1e29c6b (diff) |
gstreamer: libcamerasrc: Delete configuration before stopping camera manager
When closing the libcamerasrc, the reference to camera is released and
the camera manager is stopped. However, the camera configuration still
exists at that point, and holds a reference to the camera. This leads to
a warning from the device enumerator complaining that the media devices
are still in use:
[1:53:48.792327560] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use
[1:53:48.792354022] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media0 while still in use
A crash follows when the libcamerasrc is finalized, as deleting the
camera configuration will then release the last reference to the camera,
which attempts to delete the camera object with deleteLater() without an
event dispatcher.
Fix it by deleting the camera configuration before stopping the camera
manager.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Diffstat (limited to 'src/gstreamer/gstlibcamerasrc.cpp')
-rw-r--r-- | src/gstreamer/gstlibcamerasrc.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index a099508c..636c14df 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -499,6 +499,8 @@ gst_libcamera_src_close(GstLibcameraSrc *self) GST_DEBUG_OBJECT(self, "Releasing resources"); + state->config_.reset(); + ret = state->cam_->release(); if (ret) { GST_ELEMENT_WARNING(self, RESOURCE, BUSY, |