diff options
Diffstat (limited to 'src/qml/debugger')
-rw-r--r-- | src/qml/debugger/qqmldebug.cpp | 13 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebugconnector.cpp | 2 | ||||
-rw-r--r-- | src/qml/debugger/qqmlprofiler_p.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/qml/debugger/qqmldebug.cpp b/src/qml/debugger/qqmldebug.cpp index 58b8ea2c4f..0ca56f3a70 100644 --- a/src/qml/debugger/qqmldebug.cpp +++ b/src/qml/debugger/qqmldebug.cpp @@ -44,17 +44,26 @@ #include <private/qqmlengine_p.h> #include <private/qv4compileddata_p.h> +#include <atomic> #include <cstdio> QT_REQUIRE_CONFIG(qml_debug); QT_BEGIN_NAMESPACE +#if __cplusplus >= 202002L +# define Q_ATOMIC_FLAG_INIT {} +#else +# define Q_ATOMIC_FLAG_INIT ATOMIC_FLAG_INIT // deprecated in C++20 +#endif + +static std::atomic_flag s_printedWarning = Q_ATOMIC_FLAG_INIT; + QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning) { - if (!QQmlEnginePrivate::qml_debugging_enabled && printWarning) + if (printWarning && !s_printedWarning.test_and_set(std::memory_order_relaxed)) fprintf(stderr, "QML debugging is enabled. Only use this in a safe environment.\n"); - QQmlEnginePrivate::qml_debugging_enabled = true; + QQmlEnginePrivate::qml_debugging_enabled.store(true, std::memory_order_relaxed); } /*! diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index 0ef40d6911..01a0723b76 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -111,7 +111,7 @@ QQmlDebugConnector *QQmlDebugConnector::instance() if (!params) return nullptr; - if (!QQmlEnginePrivate::qml_debugging_enabled) { + if (!QQmlEnginePrivate::qml_debugging_enabled.load(std::memory_order_relaxed)) { if (!params->arguments.isEmpty()) { qWarning().noquote() << QString::fromLatin1( "QML Debugger: Ignoring \"-qmljsdebugger=%1\". Debugging " diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index d3eedab1c6..ed1e011830 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -176,7 +176,7 @@ public: RefLocation(QV4::ExecutableCompilationUnit *ref, const QUrl &url, const QV4::CompiledData::Object *obj, const QString &type) - : Location(QQmlSourceLocation(type, obj->location.line, obj->location.column), url), + : Location(QQmlSourceLocation(type, obj->location.line(), obj->location.column()), url), locationType(Creating), sent(false) { unit = ref; |