summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <[email protected]>2023-10-13 13:41:16 +0200
committerMarc Mutz <[email protected]>2023-10-17 18:51:16 +0000
commit744e9a69ab4965561529f66d8872b6c2455f4fca (patch)
tree3ff1b55c20ea4d07d1b17f30f4b9c246c54dc858
parentae0d231c96ab93ec36c7202c268507314eb40116 (diff)
SignalDumper: fix UB (data race on ignoreLevel)
... by making it thread_local. It is written and read by multiple threads at the same time, so it needs to be protected. Since signal emission start and end happens in a single thread, keep it thread_local rather than using an atomic. Pick-to: 6.6 6.5 Change-Id: I98fc5438c512b45f936318be31a6fccbe5b66944 Reviewed-by: Marc Mutz <[email protected]>
-rw-r--r--src/testlib/qsignaldumper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qsignaldumper.cpp b/src/testlib/qsignaldumper.cpp
index f0c35b92f9b..54b608ed501 100644
--- a/src/testlib/qsignaldumper.cpp
+++ b/src/testlib/qsignaldumper.cpp
@@ -25,7 +25,7 @@ inline static void qPrintMessage(const QByteArray &ba)
Q_GLOBAL_STATIC(QList<QByteArray>, ignoreClasses)
Q_CONSTINIT thread_local int iLevel = 0;
-static int ignoreLevel = 0;
+Q_CONSTINIT thread_local int ignoreLevel = 0;
enum { IndentSpacesCount = 4 };
static void qSignalDumperCallback(QObject *caller, int signal_index, void **argv)