Patch Detail
Show a patch.
GET /api/1.1/patches/19456/?format=api
{ "id": 19456, "url": "https://patchwork.libcamera.org/api/1.1/patches/19456/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19456/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240123011249.22716-9-laurent.pinchart@ideasonboard.com>", "date": "2024-01-23T01:12:45", "name": "[v2,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/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19456/mbox/", "series": [ { "id": 4157, "url": "https://patchwork.libcamera.org/api/1.1/series/4157/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4157", "date": "2024-01-23T01:12:37", "name": "libcamera: Hardening against thread race conditions", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4157/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19456/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19456/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 0ECF2C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Jan 2024 01:13:01 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 927316296F;\n\tTue, 23 Jan 2024 02:13:00 +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 D30F862962\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jan 2024 02:12: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 7BED5E4;\n\tTue, 23 Jan 2024 02:11:43 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NyVlstF3\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705972303;\n\tbh=5yuWptYz8PW21sw9SNhY5AR3DffrUrhkhXBqzoNDBu4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NyVlstF3lqFtspZNrpjr38V9h0SoIOORwioCa3GnmzqMKnMP8MbPP73uR3tXOoGjc\n\t8MZvYjIkJuMSf2bPm0XoUB5zHAUx3cIxoEhPlG8KPqfb1TNsQHBfuHcyE1Hp9If2Qh\n\tOEyo9KsM2v8KPlHmoVRHRmCy3SckQ70SgM6pITL0=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v2 08/12] test: signal-threads: Destroy Object from correct\n\tthread context", "Date": "Tue, 23 Jan 2024 03:12:45 +0200", "Message-ID": "<20240123011249.22716-9-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240123011249.22716-1-laurent.pinchart@ideasonboard.com>", "References": "<20240123011249.22716-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "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>" }, "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>\nReviewed-by: Milan Zamazal <mzamazal@redhat.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": [ "v2", "08/12" ] }