From 8fdd1e3867019fc62ee2bba3c8a892d8e701f8ed Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 3 Aug 2015 10:37:19 +0100 Subject: QLoggingCategory: fix default severity in Q_LOGGING_CATEGORY macro [ChangeLog][QtCore][QLoggingCategory] Fixed behavior of default severity passed to constructor or Q_LOGGING_CATEGORY with regards to QtInfoMsg, which was previously treated as being more severe than QtFatalMsg. This is because the code was using the numeric value of QtMsgType as a proxy for severity (via the <= operator), but the value of QtInfoMsg is greater than QtFatalMsg. Instead, the severity ordering must be dealt with explicitly. Change-Id: I5f178afc735221b00cb67c2cea4fa964bd9079ce Reviewed-by: Kai Koehne --- src/corelib/io/qloggingregistry.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/corelib/io/qloggingregistry.cpp') diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 11fe32529f..880e567562 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -398,10 +398,12 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) Q_ASSERT(reg->categories.contains(cat)); QtMsgType enableForLevel = reg->categories.value(cat); + // NB: note that the numeric values of the Qt*Msg constants are + // not in severity order. bool debug = (enableForLevel == QtDebugMsg); - bool info = (enableForLevel <= QtInfoMsg); - bool warning = (enableForLevel <= QtWarningMsg); - bool critical = (enableForLevel <= QtCriticalMsg); + bool info = debug || (enableForLevel == QtInfoMsg); + bool warning = info || (enableForLevel == QtWarningMsg); + bool critical = warning || (enableForLevel == QtCriticalMsg); // hard-wired implementation of // qt.*.debug=false -- cgit v1.2.3