From patchwork Wed Oct 22 07:59:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24719 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 A59E3C3259 for ; Wed, 22 Oct 2025 08:00:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 92F886079B; Wed, 22 Oct 2025 10:00:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tVzQ9Jjf"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 08ADF6069A for ; Wed, 22 Oct 2025 10:00:19 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:743e:771f:a1ba:58db]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C7D38605; Wed, 22 Oct 2025 09:58:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761119914; bh=C0DPdxPgR2W1aIYpY3KkqRUmqkUJgw7ihACq4tcQq0E=; h=From:To:Cc:Subject:Date:From; b=tVzQ9Jjf2Nyrs/xNPyukZ4SSmmMYWZkwCbK7+1Hl3eMqqk33VOBHS5vwZQyPUD9pr Wa68yy9qfCN/c1yEJer3XDPlgS9WnEnEWkUq84qlu0PnzjcCYtK47y3qYWoBvl1mdn 4mzwpPLqSBBHAauNwbXqbOJLRnEjhTc6OxTBKOKk= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH] libcamera: pipeline_handler: Fix requestComplete on waiting requests on stop Date: Wed, 22 Oct 2025 09:59:11 +0200 Message-ID: <20251022080011.97665-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 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" The requestComplete signal is not emitted when the camera is stopped and the request is still in the waitingRequests_ queue. This was reported in [1]. Fix that by calling doQueueRequest() on the waiting requests after marking them as cancelled. This ensures that the request is not queued to the device but gets added to the queuedRequests_ list. This list is then iterated in completeRequest() and leads to the requestComplete signal. [1] https://gitlab.freedesktop.org/camera/libcamera/-/issues/281 Signed-off-by: Stefan Klug --- src/libcamera/pipeline_handler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index e5f9e55c9783..3aa814069382 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -380,7 +380,15 @@ void PipelineHandler::stop(Camera *camera) while (!waitingRequests.empty()) { Request *request = waitingRequests.front(); waitingRequests.pop(); - cancelRequest(request); + + /* + * Cancel all requests by marking them as cancelled and calling + * doQueueRequest() instead of cancelRequest() to ensure the + * request is temporarily added to queuedRequests_ so it can + * then be properly completed in completeRequest(). + */ + request->_d()->cancel(); + doQueueRequest(request); } /* Make sure no requests are pending. */