From 2509fb9d2ea9cce8f30b3cee4a36e0beb624a006 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Mon, 15 May 2017 22:05:04 +0100 Subject: [PATCH] Fatal message should generate a messagebox on Windows. Qt already does this in debug builds, so this just makes release builds consistent. --- src/blackmisc/loghandler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/blackmisc/loghandler.cpp b/src/blackmisc/loghandler.cpp index 2ec027950..574c305cf 100644 --- a/src/blackmisc/loghandler.cpp +++ b/src/blackmisc/loghandler.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + namespace BlackMisc { Q_GLOBAL_STATIC(CLogHandler, g_handler) @@ -39,6 +43,9 @@ namespace BlackMisc void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) { const CStatusMessage statusMessage(type, context, message); +#if defined(Q_CC_MSVC) && defined(QT_NO_DEBUG) + if (type == QtFatalMsg) { MessageBoxW(nullptr, message.toStdWString().c_str(), nullptr, MB_OK); } +#endif if (type == QtFatalMsg && CLogHandler::instance()->thread() != QThread::currentThread()) { // Fatal message means this thread is about to crash the application. A queued connection would be useless.