diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-12-19 08:53:23 +0100 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2025-01-10 22:44:28 +0000 |
| commit | e9b82936026bcd05722625e7c74707020515cd49 (patch) | |
| tree | 02d6ab27d18fc0719a3543a7bac6882872fb79d5 | |
| parent | ae4d8a931dc6322df0019e78ee04f6342c481219 (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.
Fixes: QTBUG-132350
Change-Id: I72463a62da50ec6bb551a110c719b061273f2595
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
(cherry picked from commit 032ecd52f0657ea99d5baf852f7217447c0cc8ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 884b3c575ac2318a32fca6bcb2bfcb0db9d56b94)
| -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); } |
