diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-12-19 08:53:23 +0100 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2025-01-10 15:49:37 +0100 |
| commit | 032ecd52f0657ea99d5baf852f7217447c0cc8ad (patch) | |
| tree | 1427979a901eda2f8a962efa37022a792b943213 /src/qml/debugger/qqmldebug.cpp | |
| parent | 939b1b2f217979df32c7fb60c31987479568ad2e (diff) | |
QML debugging: Flush warning
stderr is normally unbuffered, but that behavior can be changed. Ensure
that our warning doesn't get lost by explictily flushing stderr.
Pick-to: 6.8 6.9
Fixes: QTBUG-132350
Change-Id: I72463a62da50ec6bb551a110c719b061273f2595
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qml/debugger/qqmldebug.cpp')
| -rw-r--r-- | src/qml/debugger/qqmldebug.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/debugger/qqmldebug.cpp b/src/qml/debugger/qqmldebug.cpp index b9d984db1d..69ca51d3de 100644 --- a/src/qml/debugger/qqmldebug.cpp +++ b/src/qml/debugger/qqmldebug.cpp @@ -25,8 +25,10 @@ Q_CONSTINIT static std::atomic_flag s_printedWarning = Q_ATOMIC_FLAG_INIT; void QQmlDebuggingEnabler::enableDebugging(bool printWarning) { - if (printWarning && !s_printedWarning.test_and_set(std::memory_order_relaxed)) + 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"); + fflush(stderr); // We really want to print this warning, even if stderr is buffered + } QQmlEnginePrivate::qml_debugging_enabled.store(true, std::memory_order_relaxed); } |
