<div dir="ltr"><div dir="ltr">Hi Laurent, thank you for the patch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 21, 2021 at 6:22 PM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The LOG() macro uses the global Logger and LogCategory objects<br>
internally. This can result in crashes or other undefined behaviour when<br>
logging from destructors of global objects, as the Logger and/or the<br>
LogCategory instances may have been destroyed.<br>
<br>
This isn't ideal and should eventually be fixed. For the time being,<br>
document the restriction, and add a todo list item to fix the problem.<br>
<br>
Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/libcamera/log.cpp | 6 ++++++<br>
1 file changed, 6 insertions(+)<br>
<br>
diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp<br>
index 94175ab34535..985952249289 100644<br>
--- a/src/libcamera/log.cpp<br>
+++ b/src/libcamera/log.cpp<br>
@@ -980,6 +980,12 @@ LogMessage _log(const LogCategory *category, LogSeverity severity,<br>
*<br>
* If the severity is set to Fatal, execution is aborted and the program<br>
* terminates immediately after printing the message.<br>
+ *<br>
+ * \warning Logging from the destructor of a global object, either directly or<br>
+ * indirectly, results in undefined behaviour.<br>
+ *<br>
+ * \todo Allow logging from destructors of global objects to the largest<br>
+ * possible extent<br>
*/<br>
<br>
/**<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
<br>
</blockquote></div></div>