diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-27 10:03:00 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-06-08 15:27:13 +0000 |
commit | 07c11045b614781082d251f61e14d9616cc48471 (patch) | |
tree | 4db21cda1744cf15be792ab0ca376f6bb808aa22 /src/qml/qml/qqmlengine_p.h | |
parent | 6be1936d9f1ef50433d78ade4e904b5ae87e2a78 (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.
Manual conflict resolutions:
- Removed Q_CONSTINIT, which doesn't exist in 6.2, yet.
Change-Id: I0305ab55be86a0e286016a3d1d97ee9bc0e28070
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 0434e54b55d9a31c3b5331856bab639b7149058c)
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 12d734574b..257b5371b6 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -84,6 +84,8 @@ #include <qproperty.h> +#include <atomic> + QT_BEGIN_NAMESPACE class QQmlContext; @@ -279,7 +281,7 @@ public: static bool designerMode(); static void activateDesignerMode(); - static bool qml_debugging_enabled; + static std::atomic<bool> qml_debugging_enabled; mutable QMutex networkAccessManagerMutex; |