From patchwork Mon Feb 24 01:19:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22838 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 90BC6C32A9 for ; Mon, 24 Feb 2025 01:19:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C9B39686BE; Mon, 24 Feb 2025 02:19:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Jc1xW3ih"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3931F61855 for ; Mon, 24 Feb 2025 02:19:52 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBDCA7EA; Mon, 24 Feb 2025 02:18:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1740359906; bh=BK8vo+TlYv200PQ45GHyILxc5FC+Z4ye3zrSHhTTuP8=; h=From:To:Cc:Subject:Date:From; b=Jc1xW3ihzKuoXS/l2icRM5SOCj7581r2IjwDxfZecM85CFluuHXe/QiUE0ArslTDw Zl+ldAo5BTP105olbQ0nQ2JZqABXaj+Y7kXc4uuLEpty6esd943MfTQefwmMI8ntwg c8mDuVvyskK3mM9fKDw/bXrGtdIwZ3B+t32EnIbY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Stanislaw Gruszka , Kieran Bingham Subject: [PATCH] libcamera: delayed_controls: Inherit from Object class Date: Mon, 24 Feb 2025 03:19:34 +0200 Message-ID: <20250224011934.23818-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.3 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" A second use-after-free bug related to signals staying connected after the receiver DelayedControls instance gets deleted has been found, this time in the simple pipeline handler. Fix the issue once and for all by making the DelayedControls class inherit from Object. This will disconnect signals automatically upon deletion of the receiver. Signed-off-by: Laurent Pinchart Tested-by: Stanislaw Gruszka --- Stan, would you be able to test this with the simple pipeline handler ? It should work both with and without your series that deals with the frame start signal, and should fix the crash that Kieran has reported. include/libcamera/internal/delayed_controls.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) base-commit: d476f8358be1536d4edd680c6024f784ff022f5d -- Regards, Laurent Pinchart diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h index e8d3014d92cb..b64d8bba7cf7 100644 --- a/include/libcamera/internal/delayed_controls.h +++ b/include/libcamera/internal/delayed_controls.h @@ -10,13 +10,15 @@ #include #include +#include + #include namespace libcamera { class V4L2Device; -class DelayedControls +class DelayedControls : public Object { public: struct ControlParams {