Show a patch.

GET /api/patches/17906/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17906,
    "url": "https://patchwork.libcamera.org/api/patches/17906/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17906/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20221129110005.4067748-1-paul.elder@ideasonboard.com>",
    "date": "2022-11-29T11:00:05",
    "name": "[libcamera-devel] lc-compliance: simple_capture: Free Requests properly",
    "commit_ref": "9a913eb9107483fcea01bd0e82c21e3733a5ddb2",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "89460093c794d21b6c862f115bb2bd3a4db598af",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17906/mbox/",
    "series": [
        {
            "id": 3646,
            "url": "https://patchwork.libcamera.org/api/series/3646/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3646",
            "date": "2022-11-29T11:00:05",
            "name": "[libcamera-devel] lc-compliance: simple_capture: Free Requests properly",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3646/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17906/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17906/checks/",
    "tags": {},
    "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 20185BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Nov 2022 11:00:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B5F3063336;\n\tTue, 29 Nov 2022 12:00:16 +0100 (CET)",
            "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 5E48161F24\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Nov 2022 12:00:15 +0100 (CET)",
            "from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 31BA44DA;\n\tTue, 29 Nov 2022 12:00:13 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669719616;\n\tbh=5niDgTJp4J4JtWGifODW809S015pFpzOxYdN0BE7/g8=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=lW7aJvWcCq+U49KeMSCStx5IrqPTLpZ2jreWCZ5WWzTLSV0yzDbZ0FYg2UTalkl6v\n\tCfmFg52xqIE/djaprKXhMLmp5t5lM0XKEXziWfyU8iy4CSetNnxIHKjjDs7WMffdIL\n\tbCKo3D5s20Q0PpjUuo6VxlkzojM4oHr17RLmNxsWdnHKCIo1IXT1bVjW82RNIcFyul\n\tLUwVNP8bQANQfJ5vr1KYyvGSCnY9xOo3EeFXoKXNuH60lNn7WRorMw/7DtrnBjIV3E\n\ttA/XS8JwGktuGrVB0oEgM6B8+qjwXvFqFJgPcaqF7rxDWQddCQZlxyAKwDNKONjVJN\n\tJdwEUztCmNdwA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1669719615;\n\tbh=5niDgTJp4J4JtWGifODW809S015pFpzOxYdN0BE7/g8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=b6ulLA48UPFBKpRxx2xhQ506aZcgHwEIMaylSdOtbDMnt8xZ26fnFq9Q+kReId7A9\n\tPSbvLEp8W+L3+5Bju1y7041cppg739dWSbDRB5saHGQXQRdJuRKDwEtRx4Yod9JV/V\n\tNlSXlqiHzSH7pjiS9ZKaMyG38Vprs+C7kBIsctt8="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"b6ulLA48\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 29 Nov 2022 20:00:05 +0900",
        "Message-Id": "<20221129110005.4067748-1-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] lc-compliance: simple_capture: Free\n\tRequests properly",
        "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>",
        "From": "Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Paul Elder <paul.elder@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "In the simple capture tests, in the capture functions, the Requests were\nauto-deallocated by the function going out of scope after the test\ncompleted. However, before the end of the scope, the Framebuffers that\nthe Requests referred to were manually freed. Thus when the Requests\nwere deallocated, they tried to cancel their Framebuffers, which involve\nsetting the status to cancelled, which obviously causes a segfault\nbecause the Framebuffers had already been freed.\n\nFix this by moving the list of Requests to a member variable and\ndeallocating them before deallocating the Framebuffers at stop() time.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/apps/lc-compliance/simple_capture.cpp | 7 +++----\n src/apps/lc-compliance/simple_capture.h   | 1 +\n 2 files changed, 4 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/apps/lc-compliance/simple_capture.cpp b/src/apps/lc-compliance/simple_capture.cpp\nindex ab5cb35c..cf4d7cf3 100644\n--- a/src/apps/lc-compliance/simple_capture.cpp\n+++ b/src/apps/lc-compliance/simple_capture.cpp\n@@ -65,6 +65,7 @@ void SimpleCapture::stop()\n \tcamera_->requestCompleted.disconnect(this);\n \n \tStream *stream = config_->at(0).stream();\n+\trequests_.clear();\n \tallocator_->free(stream);\n }\n \n@@ -95,7 +96,6 @@ void SimpleCaptureBalanced::capture(unsigned int numRequests)\n \tcaptureLimit_ = numRequests;\n \n \t/* Queue the recommended number of reqeuests. */\n-\tstd::vector<std::unique_ptr<libcamera::Request>> requests;\n \tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers) {\n \t\tstd::unique_ptr<Request> request = camera_->createRequest();\n \t\tASSERT_TRUE(request) << \"Can't create request\";\n@@ -104,7 +104,7 @@ void SimpleCaptureBalanced::capture(unsigned int numRequests)\n \n \t\tASSERT_EQ(queueRequest(request.get()), 0) << \"Failed to queue request\";\n \n-\t\trequests.push_back(std::move(request));\n+\t\trequests_.push_back(std::move(request));\n \t}\n \n \t/* Run capture session. */\n@@ -156,7 +156,6 @@ void SimpleCaptureUnbalanced::capture(unsigned int numRequests)\n \tcaptureLimit_ = numRequests;\n \n \t/* Queue the recommended number of reqeuests. */\n-\tstd::vector<std::unique_ptr<libcamera::Request>> requests;\n \tfor (const std::unique_ptr<FrameBuffer> &buffer : buffers) {\n \t\tstd::unique_ptr<Request> request = camera_->createRequest();\n \t\tASSERT_TRUE(request) << \"Can't create request\";\n@@ -165,7 +164,7 @@ void SimpleCaptureUnbalanced::capture(unsigned int numRequests)\n \n \t\tASSERT_EQ(camera_->queueRequest(request.get()), 0) << \"Failed to queue request\";\n \n-\t\trequests.push_back(std::move(request));\n+\t\trequests_.push_back(std::move(request));\n \t}\n \n \t/* Run capture session. */\ndiff --git a/src/apps/lc-compliance/simple_capture.h b/src/apps/lc-compliance/simple_capture.h\nindex fd9d2a97..2911d601 100644\n--- a/src/apps/lc-compliance/simple_capture.h\n+++ b/src/apps/lc-compliance/simple_capture.h\n@@ -32,6 +32,7 @@ protected:\n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n+\tstd::vector<std::unique_ptr<libcamera::Request>> requests_;\n };\n \n class SimpleCaptureBalanced : public SimpleCapture\n",
    "prefixes": [
        "libcamera-devel"
    ]
}