{"id":12337,"url":"https://patchwork.libcamera.org/api/1.1/patches/12337/?format=json","web_url":"https://patchwork.libcamera.org/patch/12337/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210521092214.1160-1-laurent.pinchart@ideasonboard.com>","date":"2021-05-21T09:22:14","name":"[libcamera-devel] libcamera: log: Document LOG() restrictions","commit_ref":"cc2139ec63c2d062b077c9c221917325c3f30f17","pull_url":null,"state":"accepted","archived":false,"hash":"fa1192e1111401489f053de93f71ea96323fd42a","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12337/mbox/","series":[{"id":2041,"url":"https://patchwork.libcamera.org/api/1.1/series/2041/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2041","date":"2021-05-21T09:22:14","name":"[libcamera-devel] libcamera: log: Document LOG() restrictions","version":1,"mbox":"https://patchwork.libcamera.org/series/2041/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12337/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12337/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 E082DC31FF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 May 2021 09:22:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 47C9D6891D;\n\tFri, 21 May 2021 11:22:21 +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 B672468918\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 May 2021 11:22:19 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 21A37ACC;\n\tFri, 21 May 2021 11:22:19 +0200 (CEST)"],"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=\"oOZ1nZBY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1621588939;\n\tbh=+JlwVUT4m9rbsp4a2GIHOFld6fO4vzJtWsBHCAZQScE=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=oOZ1nZBYWSzU3No0gygHLw9xXcYFpPh7oF6/QZvdzw6nJb/GudevfZYJ0nsIJUI4X\n\t7BZjoiFifT7BWBChu5xtOn09/Y/+kwT5jxasFi/hJpZbNDr5vdA+eZuTaNVNKSBECH\n\t+ZoPsxvYKJ3SrGq4o95RsunMjrqVXuV24ZFRyHQg=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 21 May 2021 12:22:14 +0300","Message-Id":"<20210521092214.1160-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.28.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: log: Document LOG()\n\trestrictions","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 LOG() macro uses the global Logger and LogCategory objects\ninternally. This can result in crashes or other undefined behaviour when\nlogging from destructors of global objects, as the Logger and/or the\nLogCategory instances may have been destroyed.\n\nThis isn't ideal and should eventually be fixed. For the time being,\ndocument the restriction, and add a todo list item to fix the problem.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/log.cpp | 6 ++++++\n 1 file changed, 6 insertions(+)","diff":"diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp\nindex 94175ab34535..985952249289 100644\n--- a/src/libcamera/log.cpp\n+++ b/src/libcamera/log.cpp\n@@ -980,6 +980,12 @@ LogMessage _log(const LogCategory *category, LogSeverity severity,\n  *\n  * If the severity is set to Fatal, execution is aborted and the program\n  * terminates immediately after printing the message.\n+ *\n+ * \\warning Logging from the destructor of a global object, either directly or\n+ * indirectly, results in undefined behaviour.\n+ *\n+ * \\todo Allow logging from destructors of global objects to the largest\n+ * possible extent\n  */\n \n /**\n","prefixes":["libcamera-devel"]}