[{"id":13601,"web_url":"https://patchwork.libcamera.org/comment/13601/","msgid":"<634fe0150b495fccaf4b214cf74f3518bbf8a686.camel@collabora.com>","date":"2020-11-04T14:28:59","subject":"Re: [libcamera-devel] [PATCH] gstreamer: libcamerasrc: Delete\n\tconfiguration before stopping camera manager","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Le mercredi 04 novembre 2020 à 10:27 +0200, Laurent Pinchart a écrit :\n> When closing the libcamerasrc, the reference to camera is released and\n> the camera manager is stopped. However, the camera configuration still\n> exists at that point, and holds a reference to the camera. This leads to\n> a warning from the device enumerator complaining that the media devices\n> are still in use:\n> \n> [1:53:48.792327560] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use\n> [1:53:48.792354022] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media0 while still in use\n> \n> A crash follows when the libcamerasrc is finalized, as deleting the\n> camera configuration will then release the last reference to the camera,\n> which attempts to delete the camera object with deleteLater() without an\n> event dispatcher.\n> \n> Fix it by deleting the camera configuration before stopping the camera\n> manager.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index a099508c122a..636c14dff64e 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -499,6 +499,8 @@ gst_libcamera_src_close(GstLibcameraSrc *self)\n>  \n> \n> \n> \n>  \tGST_DEBUG_OBJECT(self, \"Releasing resources\");\n>  \n> \n> \n> \n> +\tstate->config_.reset();\n> +\n>  \tret = state->cam_->release();\n>  \tif (ret) {\n>  \t\tGST_ELEMENT_WARNING(self, RESOURCE, BUSY,","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3F923BDB89\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Nov 2020 14:29:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B05CE62C6C;\n\tWed,  4 Nov 2020 15:29:07 +0100 (CET)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EC3262B91\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Nov 2020 15:29:03 +0100 (CET)","from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nicolas) with ESMTPSA id C43FA1F45881"],"Message-ID":"<634fe0150b495fccaf4b214cf74f3518bbf8a686.camel@collabora.com>","From":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 04 Nov 2020 09:28:59 -0500","In-Reply-To":"<20201104082719.25190-1-laurent.pinchart@ideasonboard.com>","References":"<20201104082719.25190-1-laurent.pinchart@ideasonboard.com>","Organization":"Collabora","User-Agent":"Evolution 3.38.1 (3.38.1-1.fc33) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH] gstreamer: libcamerasrc: Delete\n\tconfiguration before stopping camera manager","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Reply-To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Content-Type":"multipart/mixed;\n\tboundary=\"===============6979277713884091769==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]