From 6d05f5faff8b125c3e43192b857990e7f0ff208d Mon Sep 17 00:00:00 2001 From: Alejandro Exojo Date: Fri, 7 Mar 2014 12:20:30 +0100 Subject: [PATCH] Make QtCriticalMsg exit on QT_FATAL_CRITICALS Change-Id: I92e8f9851dd074f3bcded6981f5545d1e93b549f Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira Reviewed-by: Kai Koehne --- src/corelib/global/qglobal.cpp | 2 ++ src/corelib/global/qlogging.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 108866b8df..66664f0f2a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3291,6 +3291,8 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) stderr. Under Windows, the message is sent to the debugger. On Blackberry the message is sent to slogger2. + It exits if the environment variable QT_FATAL_CRITICALS is not empty. + This function takes a format string and a list of arguments, similar to the C printf() function. The format should be a Latin-1 string. diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 64dd544cf0..d8ef8a57a8 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -83,6 +83,11 @@ static bool isFatal(QtMsgType msgType) if (msgType == QtFatalMsg) return true; + if (msgType == QtCriticalMsg) { + static bool fatalCriticals = !qEnvironmentVariableIsEmpty("QT_FATAL_CRITICALS"); + return fatalCriticals; + } + if (msgType == QtWarningMsg || msgType == QtCriticalMsg) { static bool fatalWarnings = !qEnvironmentVariableIsEmpty("QT_FATAL_WARNINGS"); return fatalWarnings;