From 13a8b83a0ec7c63cc9600b56485f21b7d8f5c273 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 21 Jun 2018 14:16:17 +0300 Subject: [PATCH] Flush buffer after adding a string, not before. --HG-- branch : develop --- src/app/tape/mapplication.cpp | 3 +++ src/app/valentina/core/vapplication.cpp | 2 ++ src/libs/vmisc/vsysexits.h | 6 ++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index c11809f16..b3332f578 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -159,6 +159,9 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con break; } + vStdOut().flush(); + vStdErr().flush(); + if (isGuiThread) { //fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 56c358081..d2f64a169 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -170,6 +170,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con default: break; } + vStdOut().flush(); + vStdErr().flush(); (*qApp->LogFile()) << debugdate << endl; } diff --git a/src/libs/vmisc/vsysexits.h b/src/libs/vmisc/vsysexits.h index 6f77c41c3..389c980ee 100644 --- a/src/libs/vmisc/vsysexits.h +++ b/src/libs/vmisc/vsysexits.h @@ -82,18 +82,16 @@ static const auto V_UNUSED V_EX_CONFIG = 78; /*Something was found in an un //--------------------------------------------------------------------------------------------------------------------- inline QTextStream& vStdErr() { - static QTextStream ts( stderr ); + static QTextStream ts(stderr, QIODevice::Unbuffered | QIODevice::WriteOnly); ts.setCodec("UTF-8"); - ts.flush(); return ts; } //--------------------------------------------------------------------------------------------------------------------- inline QTextStream& vStdOut() { - static QTextStream ts( stdout ); + static QTextStream ts(stdout, QIODevice::Unbuffered | QIODevice::WriteOnly); ts.setCodec("UTF-8"); - ts.flush(); return ts; }