Show a patch.

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

{
    "id": 19429,
    "url": "https://patchwork.libcamera.org/api/patches/19429/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19429/",
    "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": "<20240121035948.4226-9-laurent.pinchart@ideasonboard.com>",
    "date": "2024-01-21T03:59:44",
    "name": "[libcamera-devel,08/12] test: signal-threads: Destroy Object from correct thread context",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f673b16bf12e4bd5b3a03c1be46699a858fb2229",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19429/mbox/",
    "series": [
        {
            "id": 4149,
            "url": "https://patchwork.libcamera.org/api/series/4149/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4149",
            "date": "2024-01-21T03:59:36",
            "name": "libcamera: Hardening against thread race conditions",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4149/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19429/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19429/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 CE412C3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 21 Jan 2024 04:00:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9BE6A62916;\n\tSun, 21 Jan 2024 05:00:04 +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 8D36A6294C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 21 Jan 2024 04:59:56 +0100 (CET)",
            "from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7ED918D4;\n\tSun, 21 Jan 2024 04:58:44 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1705809604;\n\tbh=1Ry5mE8qE3p3JgOCxvID4DWvwVQFWwR6qvm0EdZYFoA=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=KOB4wTB9tPZb8tkir24GoNClJOja4IiZmi4Ag+NesfLeK/ZFZCWdQkeCq2pdwzeqo\n\tpVWfdzTGj7TqoFAdyqng5zd3vSoSyB7WIzuHkK6nxiteD4C/NSNfmRFrH/zNIUbuun\n\tN9Ip6DesSKh1ts6LksjXuqL0YHFvVZt5sIm64+avwxmSHVWXI6ffGN9XDFMU4t7xA9\n\tSEDF/DG2E21TMoK0GkxtYKqZS6EuLmdzyDvWtK66guV166T/npM96dt6r/l4Dr3SgM\n\tBq88sjMuCqhOuPECtwCyGR8o4HHBtK43cNGvgq7+7fr/yzqU85YB3CTqHOymlMyRDt\n\tsdje7vTXN8qCQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705809524;\n\tbh=1Ry5mE8qE3p3JgOCxvID4DWvwVQFWwR6qvm0EdZYFoA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=fM6IyA2EhO+JmsY69T9HKYc4+zi7IDCUVLaPqUS8ai0yWvWW5iRxAMykVTxItTVZs\n\tQ63IaZ4/sK5dhTDMVnnQzkNfiGX13vUUri5g5qD+tvEZa2FcM+cI0p8b1RD5J3KKYr\n\t49RSH5eFA0CZN6FuAMR+O981sCt+MVpdQRoXEJLI="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fM6IyA2E\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 21 Jan 2024 05:59:44 +0200",
        "Message-ID": "<20240121035948.4226-9-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 08/12] test: signal-threads: Destroy\n\tObject from correct thread context",
        "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The SignalReceiver used in the test is destroyed from the main thread,\nwhich is invalid for a thread-bound object bound to a different thread.\nFix it by destroying it with deleteLater().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/signal-threads.cpp | 23 +++++++++++++++--------\n 1 file changed, 15 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/test/signal-threads.cpp b/test/signal-threads.cpp\nindex 8c550eb014d8..8c212b6f9ade 100644\n--- a/test/signal-threads.cpp\n+++ b/test/signal-threads.cpp\n@@ -59,15 +59,20 @@ private:\n class SignalThreadsTest : public Test\n {\n protected:\n+\tint init()\n+\t{\n+\t\treceiver_ = new SignalReceiver();\n+\t\tsignal_.connect(receiver_, &SignalReceiver::slot);\n+\n+\t\treturn TestPass;\n+\t}\n+\n \tint run()\n \t{\n-\t\tSignalReceiver receiver;\n-\t\tsignal_.connect(&receiver, &SignalReceiver::slot);\n-\n \t\t/* Test that a signal is received in the main thread. */\n \t\tsignal_.emit(0);\n \n-\t\tswitch (receiver.status()) {\n+\t\tswitch (receiver_->status()) {\n \t\tcase SignalReceiver::NoSignal:\n \t\t\tcout << \"No signal received for direct connection\" << endl;\n \t\t\treturn TestFail;\n@@ -83,8 +88,8 @@ protected:\n \t\t * Move the object to a thread and verify that the signal is\n \t\t * correctly delivered, with the correct data.\n \t\t */\n-\t\treceiver.reset();\n-\t\treceiver.moveToThread(&thread_);\n+\t\treceiver_->reset();\n+\t\treceiver_->moveToThread(&thread_);\n \n \t\tthread_.start();\n \n@@ -92,7 +97,7 @@ protected:\n \n \t\tthis_thread::sleep_for(chrono::milliseconds(100));\n \n-\t\tswitch (receiver.status()) {\n+\t\tswitch (receiver_->status()) {\n \t\tcase SignalReceiver::NoSignal:\n \t\t\tcout << \"No signal received for message connection\" << endl;\n \t\t\treturn TestFail;\n@@ -104,7 +109,7 @@ protected:\n \t\t\tbreak;\n \t\t}\n \n-\t\tif (receiver.value() != 42) {\n+\t\tif (receiver_->value() != 42) {\n \t\t\tcout << \"Signal received with incorrect value\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n@@ -114,11 +119,13 @@ protected:\n \n \tvoid cleanup()\n \t{\n+\t\treceiver_->deleteLater();\n \t\tthread_.exit(0);\n \t\tthread_.wait();\n \t}\n \n private:\n+\tSignalReceiver *receiver_;\n \tThread thread_;\n \n \tSignal<int> signal_;\n",
    "prefixes": [
        "libcamera-devel",
        "08/12"
    ]
}