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 <marc.mutz@qt.io>
This commit is contained in:
Mårten Nordheim 2023-10-13 13:41:16 +02:00 committed by Marc Mutz
parent ae0d231c96
commit 744e9a69ab

View File

@ -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)