From 731a340c8064843075cb9a41e22908eadadbf1bd Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Wed, 5 Nov 2025 14:58:19 +0100 Subject: [PATCH] libcamera: pipeline_handler: Fix requestComplete on waiting requests on stop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The requestComplete signal is not emitted when the camera is stopped and the request is still in the waitingRequests_ queue. Fix that by calling doQueueRequest() on the waiting requests after marking them as cancelled. This ensures that the requests gets a proper sequence number and are added to the queuedRequests_ list. This list is then iterated in completeRequest() and leads to the requestComplete signal. Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/281 Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Barnabás Pőcze --- src/libcamera/pipeline_handler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 15fb3256..ca6215ec 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -380,7 +380,16 @@ 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(). This ensures + * that the requests get a sequence number and are temporarily + * added to queuedRequests_ so they can be properly completed in + * completeRequest(). + */ + request->_d()->cancel(); + doQueueRequest(request); } /* Make sure no requests are pending. */