[{"id":34729,"web_url":"https://patchwork.libcamera.org/comment/34729/","msgid":"<jjhw43jcmms4spfryfuen3hb2bmrb6jhpty5rgcancbgtgo7h2@z4w632vifwcd>","date":"2025-06-30T08:53:30","subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"Hi Stefan,\n\nOn Mon, Jun 30, 2025 at 10:11:16AM +0200, Stefan Klug wrote:\n> The waiting requests of one camera should not be able to influence\n> queuing to another camera. Therefore change the single waitingRequests_\n> queue into one queue per camera.\n\nI would just expand on the influence of this common waiting queue,\nfor e.g. on the stop() cycle, which seems to be a bug now (and fixed\nwith this patch).\n\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> \n> Changes in v1:\n> - Added camera param to doQueueRequests() which allows to remove a loop\n> ---\n>  include/libcamera/internal/camera.h           |  2 ++\n>  include/libcamera/internal/pipeline_handler.h |  5 +---\n>  src/libcamera/pipeline_handler.cpp            | 26 ++++++++++++-------\n>  3 files changed, 19 insertions(+), 14 deletions(-)\n> \n> diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h\n> index 18f5c32a18e4..8a2e9ed5894d 100644\n> --- a/include/libcamera/internal/camera.h\n> +++ b/include/libcamera/internal/camera.h\n> @@ -10,6 +10,7 @@\n>  #include <atomic>\n>  #include <list>\n>  #include <memory>\n> +#include <queue>\n>  #include <set>\n>  #include <stdint.h>\n>  #include <string>\n> @@ -36,6 +37,7 @@ public:\n>  \tconst PipelineHandler *pipe() const { return pipe_.get(); }\n>  \n>  \tstd::list<Request *> queuedRequests_;\n> +\tstd::queue<Request *> waitingRequests_;\n>  \tControlInfoMap controlInfo_;\n>  \tControlList properties_;\n>  \n> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\n> index 972a2fa65310..be017ad47219 100644\n> --- a/include/libcamera/internal/pipeline_handler.h\n> +++ b/include/libcamera/internal/pipeline_handler.h\n> @@ -8,7 +8,6 @@\n>  #pragma once\n>  \n>  #include <memory>\n> -#include <queue>\n>  #include <string>\n>  #include <sys/types.h>\n>  #include <vector>\n> @@ -89,13 +88,11 @@ private:\n>  \tvirtual void disconnect();\n>  \n>  \tvoid doQueueRequest(Request *request);\n> -\tvoid doQueueRequests();\n> +\tvoid doQueueRequests(Camera *camera);\n>  \n>  \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n>  \tstd::vector<std::weak_ptr<Camera>> cameras_;\n>  \n> -\tstd::queue<Request *> waitingRequests_;\n> -\n>  \tconst char *name_;\n>  \tunsigned int useCount_;\n>  \n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index d84dff3c9f19..dc4086aa9bb5 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -363,15 +363,16 @@ void PipelineHandler::stop(Camera *camera)\n>  \t/* Stop the pipeline handler and let the queued requests complete. */\n>  \tstopDevice(camera);\n>  \n> +\tCamera::Private *data = camera->_d();\n> +\n>  \t/* Cancel and signal as complete all waiting requests. */\n> -\twhile (!waitingRequests_.empty()) {\n> -\t\tRequest *request = waitingRequests_.front();\n> -\t\twaitingRequests_.pop();\n> +\twhile (!data->waitingRequests_.empty()) {\n> +\t\tRequest *request = data->waitingRequests_.front();\n> +\t\tdata->waitingRequests_.pop();\n>  \t\tcancelRequest(request);\n>  \t}\n>  \n>  \t/* Make sure no requests are pending. */\n> -\tCamera::Private *data = camera->_d();\n>  \tASSERT(data->queuedRequests_.empty());\n>  \n>  \tdata->requestSequence_ = 0;\n> @@ -414,7 +415,9 @@ void PipelineHandler::registerRequest(Request *request)\n>  \t * Connect the request prepared signal to notify the pipeline handler\n>  \t * when a request is ready to be processed.\n>  \t */\n> -\trequest->_d()->prepared.connect(this, &PipelineHandler::doQueueRequests);\n> +\trequest->_d()->prepared.connect(this, [&]() {\n> +\t\tdoQueueRequests(request->_d()->camera());\n> +\t});\n>  }\n>  \n>  /**\n> @@ -444,7 +447,9 @@ void PipelineHandler::queueRequest(Request *request)\n>  {\n>  \tLIBCAMERA_TRACEPOINT(request_queue, request);\n>  \n> -\twaitingRequests_.push(request);\n> +\tCamera *camera = request->_d()->camera();\n> +\tCamera::Private *data = camera->_d();\n> +\tdata->waitingRequests_.push(request);\n>  \n>  \trequest->_d()->prepare(300ms);\n>  }\n> @@ -478,15 +483,16 @@ void PipelineHandler::doQueueRequest(Request *request)\n>   * Iterate the list of waiting requests and queue them to the device one\n>   * by one if they have been prepared.\n>   */\n> -void PipelineHandler::doQueueRequests()\n> +void PipelineHandler::doQueueRequests(Camera *camera)\n>  {\n> -\twhile (!waitingRequests_.empty()) {\n> -\t\tRequest *request = waitingRequests_.front();\n> +\tCamera::Private *data = camera->_d();\n> +\twhile (!data->waitingRequests_.empty()) {\n> +\t\tRequest *request = data->waitingRequests_.front();\n>  \t\tif (!request->_d()->prepared_)\n>  \t\t\tbreak;\n>  \n>  \t\tdoQueueRequest(request);\n\nnit: I wonder if it would be beneficial (probably in a follow up patch)\nto expand the doQueueRequest() function here itself, as the loop is\nfetching Camera::Private and Camera pointers again, which is readily\navailable above, along with request (meant to be queued).\n\nOther than that, this looks good to me:\n\nReviewed-by: Umang Jain <uajain@igalia.com>\n\n> -\t\twaitingRequests_.pop();\n> +\t\tdata->waitingRequests_.pop();\n>  \t}\n>  }\n>  \n> -- \n> 2.48.1\n>","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 866F0C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Jun 2025 08:53:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B1EA68E05;\n\tMon, 30 Jun 2025 10:53:29 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5225961529\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jun 2025 10:53:27 +0200 (CEST)","from [49.36.69.141] (helo=uajain)\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uWAGU-00AOl8-3p; Mon, 30 Jun 2025 10:53:26 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"GB70f9oC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:\n\tSubject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=R4L9OkCbGJ5T0khj1TUfZzSjBLm4yFpBeklVkZ4qob4=;\n\tb=GB70f9oC6ie2u83AncJiKp1rPj\n\tdzc0AGdzv2Tkm+ohXxSf3O4bGa+0+wxL9Lf7ssJiUULQRmAEJq5oLW68xHV7nzBqRR2kkDJ/ZaRVD\n\tKZQxhKvupGs2aN+kTfFrVHSCWb3+XUSQ03TqtC33TPs7vHMcUgYQXA3c2mCPyhBZwDgTFYMQ4pKFY\n\tycvRwOJ7uZfCOqj99gUKSy0Z0k81VCcozfjAku5hdqASy0NjhT3hkCkSBVUn3Gi4qXDPCrIKtT5ip\n\tx6V5oNzMiuLCkhyrfyiDkB1aYSASeH5aKOJlABeyNVdNf0qEpcnaidfnjyIX16O2TUJjwNEvh9jUi\n\t0BPRRyjQ==;","Date":"Mon, 30 Jun 2025 14:23:30 +0530","From":"Umang Jain <uajain@igalia.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","Message-ID":"<jjhw43jcmms4spfryfuen3hb2bmrb6jhpty5rgcancbgtgo7h2@z4w632vifwcd>","References":"<20250630081126.2384387-1-stefan.klug@ideasonboard.com>\n\t<20250630081126.2384387-2-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20250630081126.2384387-2-stefan.klug@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34738,"web_url":"https://patchwork.libcamera.org/comment/34738/","msgid":"<01a89fd6-8723-438a-afed-b45114ffbfc1@ideasonboard.com>","date":"2025-06-30T11:00:58","subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 06. 30. 10:11 keltezéssel, Stefan Klug írta:\n> The waiting requests of one camera should not be able to influence\n> queuing to another camera. Therefore change the single waitingRequests_\n> queue into one queue per camera.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> \n> Changes in v1:\n> - Added camera param to doQueueRequests() which allows to remove a loop\n> ---\n>   include/libcamera/internal/camera.h           |  2 ++\n>   include/libcamera/internal/pipeline_handler.h |  5 +---\n>   src/libcamera/pipeline_handler.cpp            | 26 ++++++++++++-------\n>   3 files changed, 19 insertions(+), 14 deletions(-)\n> \n> diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h\n> index 18f5c32a18e4..8a2e9ed5894d 100644\n> --- a/include/libcamera/internal/camera.h\n> +++ b/include/libcamera/internal/camera.h\n> @@ -10,6 +10,7 @@\n>   #include <atomic>\n>   #include <list>\n>   #include <memory>\n> +#include <queue>\n>   #include <set>\n>   #include <stdint.h>\n>   #include <string>\n> @@ -36,6 +37,7 @@ public:\n>   \tconst PipelineHandler *pipe() const { return pipe_.get(); }\n>   \n>   \tstd::list<Request *> queuedRequests_;\n> +\tstd::queue<Request *> waitingRequests_;\n>   \tControlInfoMap controlInfo_;\n>   \tControlList properties_;\n>   \n> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\n> index 972a2fa65310..be017ad47219 100644\n> --- a/include/libcamera/internal/pipeline_handler.h\n> +++ b/include/libcamera/internal/pipeline_handler.h\n> @@ -8,7 +8,6 @@\n>   #pragma once\n>   \n>   #include <memory>\n> -#include <queue>\n>   #include <string>\n>   #include <sys/types.h>\n>   #include <vector>\n> @@ -89,13 +88,11 @@ private:\n>   \tvirtual void disconnect();\n>   \n>   \tvoid doQueueRequest(Request *request);\n> -\tvoid doQueueRequests();\n> +\tvoid doQueueRequests(Camera *camera);\n>   \n>   \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n>   \tstd::vector<std::weak_ptr<Camera>> cameras_;\n>   \n> -\tstd::queue<Request *> waitingRequests_;\n> -\n>   \tconst char *name_;\n>   \tunsigned int useCount_;\n>   \n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index d84dff3c9f19..dc4086aa9bb5 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -363,15 +363,16 @@ void PipelineHandler::stop(Camera *camera)\n>   \t/* Stop the pipeline handler and let the queued requests complete. */\n>   \tstopDevice(camera);\n>   \n> +\tCamera::Private *data = camera->_d();\n> +\n>   \t/* Cancel and signal as complete all waiting requests. */\n> -\twhile (!waitingRequests_.empty()) {\n> -\t\tRequest *request = waitingRequests_.front();\n> -\t\twaitingRequests_.pop();\n> +\twhile (!data->waitingRequests_.empty()) {\n> +\t\tRequest *request = data->waitingRequests_.front();\n> +\t\tdata->waitingRequests_.pop();\n>   \t\tcancelRequest(request);\n>   \t}\n>   \n>   \t/* Make sure no requests are pending. */\n> -\tCamera::Private *data = camera->_d();\n>   \tASSERT(data->queuedRequests_.empty());\n>   \n>   \tdata->requestSequence_ = 0;\n> @@ -414,7 +415,9 @@ void PipelineHandler::registerRequest(Request *request)\n>   \t * Connect the request prepared signal to notify the pipeline handler\n>   \t * when a request is ready to be processed.\n>   \t */\n> -\trequest->_d()->prepared.connect(this, &PipelineHandler::doQueueRequests);\n> +\trequest->_d()->prepared.connect(this, [&]() {\n\nThis captures `request` by reference, which is a local variable and will\nnot exists when this callback runs. It should be `[request]` or similar.\n\nThis likely explains the CI failure: https://gitlab.freedesktop.org/camera/libcamera/-/pipelines/1460735\n\n\nRegards,\nBarnabás Pőcze\n\n\n> +\t\tdoQueueRequests(request->_d()->camera());\n> +\t});\n>   }\n>   \n>   /**\n> @@ -444,7 +447,9 @@ void PipelineHandler::queueRequest(Request *request)\n>   {\n>   \tLIBCAMERA_TRACEPOINT(request_queue, request);\n>   \n> -\twaitingRequests_.push(request);\n> +\tCamera *camera = request->_d()->camera();\n> +\tCamera::Private *data = camera->_d();\n> +\tdata->waitingRequests_.push(request);\n>   \n>   \trequest->_d()->prepare(300ms);\n>   }\n> @@ -478,15 +483,16 @@ void PipelineHandler::doQueueRequest(Request *request)\n>    * Iterate the list of waiting requests and queue them to the device one\n>    * by one if they have been prepared.\n>    */\n> -void PipelineHandler::doQueueRequests()\n> +void PipelineHandler::doQueueRequests(Camera *camera)\n>   {\n> -\twhile (!waitingRequests_.empty()) {\n> -\t\tRequest *request = waitingRequests_.front();\n> +\tCamera::Private *data = camera->_d();\n> +\twhile (!data->waitingRequests_.empty()) {\n> +\t\tRequest *request = data->waitingRequests_.front();\n>   \t\tif (!request->_d()->prepared_)\n>   \t\t\tbreak;\n>   \n>   \t\tdoQueueRequest(request);\n> -\t\twaitingRequests_.pop();\n> +\t\tdata->waitingRequests_.pop();\n>   \t}\n>   }\n>","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 2CB3FC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Jun 2025 11:01:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B40CA68E04;\n\tMon, 30 Jun 2025 13:01:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 15D8661527\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jun 2025 13:01:03 +0200 (CEST)","from [192.168.33.21] (185.221.143.107.nat.pool.zt.hu\n\t[185.221.143.107])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EBEF111EB;\n\tMon, 30 Jun 2025 13:00:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GVSXFO1Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751281241;\n\tbh=vnxwT77c8vhhJvyIy6jKjVMzl53pHBN4Um9Xb8rc1lo=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=GVSXFO1QdfwrrUnKcQHV8RgjwVnBeCdZqTPXPD0kyVbs9/RwINKkLO/5256EuutIj\n\tWXsj+o2ihWJuAiunOBFLY2b9gTYbfl5g4NSQ7kTzf4p8Y4HmrYJ+kK/GHMT0zAVxLh\n\tDZ/EgRrrVbzjoj0QcCswj5BrkRNIE4pc+JA7/Nlc=","Message-ID":"<01a89fd6-8723-438a-afed-b45114ffbfc1@ideasonboard.com>","Date":"Mon, 30 Jun 2025 13:00:58 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20250630081126.2384387-1-stefan.klug@ideasonboard.com>\n\t<20250630081126.2384387-2-stefan.klug@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250630081126.2384387-2-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34745,"web_url":"https://patchwork.libcamera.org/comment/34745/","msgid":"<175130010281.2426344.12102807852734729055@localhost>","date":"2025-06-30T16:15:02","subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Barnabás,\n\nQuoting Barnabás Pőcze (2025-06-30 13:00:58)\n> Hi\n> \n> 2025. 06. 30. 10:11 keltezéssel, Stefan Klug írta:\n> > The waiting requests of one camera should not be able to influence\n> > queuing to another camera. Therefore change the single waitingRequests_\n> > queue into one queue per camera.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > \n> > ---\n> > \n> > Changes in v1:\n> > - Added camera param to doQueueRequests() which allows to remove a loop\n> > ---\n> >   include/libcamera/internal/camera.h           |  2 ++\n> >   include/libcamera/internal/pipeline_handler.h |  5 +---\n> >   src/libcamera/pipeline_handler.cpp            | 26 ++++++++++++-------\n> >   3 files changed, 19 insertions(+), 14 deletions(-)\n> > \n> > diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h\n> > index 18f5c32a18e4..8a2e9ed5894d 100644\n> > --- a/include/libcamera/internal/camera.h\n> > +++ b/include/libcamera/internal/camera.h\n> > @@ -10,6 +10,7 @@\n> >   #include <atomic>\n> >   #include <list>\n> >   #include <memory>\n> > +#include <queue>\n> >   #include <set>\n> >   #include <stdint.h>\n> >   #include <string>\n> > @@ -36,6 +37,7 @@ public:\n> >       const PipelineHandler *pipe() const { return pipe_.get(); }\n> >   \n> >       std::list<Request *> queuedRequests_;\n> > +     std::queue<Request *> waitingRequests_;\n> >       ControlInfoMap controlInfo_;\n> >       ControlList properties_;\n> >   \n> > diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\n> > index 972a2fa65310..be017ad47219 100644\n> > --- a/include/libcamera/internal/pipeline_handler.h\n> > +++ b/include/libcamera/internal/pipeline_handler.h\n> > @@ -8,7 +8,6 @@\n> >   #pragma once\n> >   \n> >   #include <memory>\n> > -#include <queue>\n> >   #include <string>\n> >   #include <sys/types.h>\n> >   #include <vector>\n> > @@ -89,13 +88,11 @@ private:\n> >       virtual void disconnect();\n> >   \n> >       void doQueueRequest(Request *request);\n> > -     void doQueueRequests();\n> > +     void doQueueRequests(Camera *camera);\n> >   \n> >       std::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n> >       std::vector<std::weak_ptr<Camera>> cameras_;\n> >   \n> > -     std::queue<Request *> waitingRequests_;\n> > -\n> >       const char *name_;\n> >       unsigned int useCount_;\n> >   \n> > diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> > index d84dff3c9f19..dc4086aa9bb5 100644\n> > --- a/src/libcamera/pipeline_handler.cpp\n> > +++ b/src/libcamera/pipeline_handler.cpp\n> > @@ -363,15 +363,16 @@ void PipelineHandler::stop(Camera *camera)\n> >       /* Stop the pipeline handler and let the queued requests complete. */\n> >       stopDevice(camera);\n> >   \n> > +     Camera::Private *data = camera->_d();\n> > +\n> >       /* Cancel and signal as complete all waiting requests. */\n> > -     while (!waitingRequests_.empty()) {\n> > -             Request *request = waitingRequests_.front();\n> > -             waitingRequests_.pop();\n> > +     while (!data->waitingRequests_.empty()) {\n> > +             Request *request = data->waitingRequests_.front();\n> > +             data->waitingRequests_.pop();\n> >               cancelRequest(request);\n> >       }\n> >   \n> >       /* Make sure no requests are pending. */\n> > -     Camera::Private *data = camera->_d();\n> >       ASSERT(data->queuedRequests_.empty());\n> >   \n> >       data->requestSequence_ = 0;\n> > @@ -414,7 +415,9 @@ void PipelineHandler::registerRequest(Request *request)\n> >        * Connect the request prepared signal to notify the pipeline handler\n> >        * when a request is ready to be processed.\n> >        */\n> > -     request->_d()->prepared.connect(this, &PipelineHandler::doQueueRequests);\n> > +     request->_d()->prepared.connect(this, [&]() {\n> \n> This captures `request` by reference, which is a local variable and will\n> not exists when this callback runs. It should be `[request]` or similar.\n> \n> This likely explains the CI failure: https://gitlab.freedesktop.org/camera/libcamera/-/pipelines/1460735\n\nOuch, that is a silly one. One of theses if it compiles it runs cases.\nI'll fix that.\n\nThanks,\nStefan\n\n> \n> \n> Regards,\n> Barnabás Pőcze\n> \n> \n> > +             doQueueRequests(request->_d()->camera());\n> > +     });\n> >   }\n> >   \n> >   /**\n> > @@ -444,7 +447,9 @@ void PipelineHandler::queueRequest(Request *request)\n> >   {\n> >       LIBCAMERA_TRACEPOINT(request_queue, request);\n> >   \n> > -     waitingRequests_.push(request);\n> > +     Camera *camera = request->_d()->camera();\n> > +     Camera::Private *data = camera->_d();\n> > +     data->waitingRequests_.push(request);\n> >   \n> >       request->_d()->prepare(300ms);\n> >   }\n> > @@ -478,15 +483,16 @@ void PipelineHandler::doQueueRequest(Request *request)\n> >    * Iterate the list of waiting requests and queue them to the device one\n> >    * by one if they have been prepared.\n> >    */\n> > -void PipelineHandler::doQueueRequests()\n> > +void PipelineHandler::doQueueRequests(Camera *camera)\n> >   {\n> > -     while (!waitingRequests_.empty()) {\n> > -             Request *request = waitingRequests_.front();\n> > +     Camera::Private *data = camera->_d();\n> > +     while (!data->waitingRequests_.empty()) {\n> > +             Request *request = data->waitingRequests_.front();\n> >               if (!request->_d()->prepared_)\n> >                       break;\n> >   \n> >               doQueueRequest(request);\n> > -             waitingRequests_.pop();\n> > +             data->waitingRequests_.pop();\n> >       }\n> >   }\n> >   \n>","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 0C413BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Jun 2025 16:15:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9501168E04;\n\tMon, 30 Jun 2025 18:15:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8787761527\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jun 2025 18:15:06 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:883b:eaf8:7aec:d1d4])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 5E8CFEFF;\n\tMon, 30 Jun 2025 18:14:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pAJkDMnC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751300084;\n\tbh=Q2a7L3ZeI7sDeAnqKrVD5sCGXP8I9F0QT0r1rvOyiQ0=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=pAJkDMnCS91Agl6vMBL/uXkcGmv3lduoxMf7djg5+1STSrZb3zbC3XNhfKnvuDkuo\n\tAKmYVrv/veqhYTv31A+Z4aH9kQgF2aBqLp9CGgaNpJqQCp45s0ppmLzSbZPQpQgvF+\n\tIJEsQKUYe0hOnmMQetABXYLZixCQ8ckLsrlTAStI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<01a89fd6-8723-438a-afed-b45114ffbfc1@ideasonboard.com>","References":"<20250630081126.2384387-1-stefan.klug@ideasonboard.com>\n\t<20250630081126.2384387-2-stefan.klug@ideasonboard.com>\n\t<01a89fd6-8723-438a-afed-b45114ffbfc1@ideasonboard.com>","Subject":"Re: [PATCH v1 1/6] libcamera: pipeline_handler: Move\n\twaitingRequests_ into camera class","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 30 Jun 2025 18:15:02 +0200","Message-ID":"<175130010281.2426344.12102807852734729055@localhost>","User-Agent":"alot/0.12.dev8+g2c003385c862.d20250602","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]