diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-27 10:03:00 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-05-31 17:23:09 +0200 |
commit | 0434e54b55d9a31c3b5331856bab639b7149058c (patch) | |
tree | 306dd5766f4dbb12c0242d09d1d8c742485f1620 /src/qml/qml/qqmlengine_p.h | |
parent | c98c2c08a5f926b67c40b6363274d23066bfe341 (diff) |
Fix race condition on QQmlEnginePrivate::qml_debugging_enabled
C++11 allows static dynamic initialization from different TUs to
happen concurrently, which means the QQmlDebuggingEnabler ctor must be
re-entrant and synchronized with other users of qml_debugging_enabled.
Thankfully, this is just a flag, so the fix is to simply make it
atomic<> and use relaxed loads and stores on it.
Pick-to: 6.3 6.2 5.15
Change-Id: I0305ab55be86a0e286016a3d1d97ee9bc0e28070
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine_p.h')
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index b914afdaf1..e8211b1a38 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -80,6 +80,8 @@ #include <QtCore/qstring.h> #include <QtCore/qthread.h> +#include <atomic> + QT_BEGIN_NAMESPACE class QNetworkAccessManager; @@ -236,7 +238,7 @@ public: static bool designerMode(); static void activateDesignerMode(); - static bool qml_debugging_enabled; + static std::atomic<bool> qml_debugging_enabled; mutable QMutex networkAccessManagerMutex; |