From ab5e444c8fd754321ef0a6b084248e431e84a7a8 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sun, 15 Sep 2019 17:51:21 +0200 Subject: Remove remaining traces of deprecated QtMsgHandler Change-Id: I28aecb444eb9bc9e26e6ff8998904dbf28419f25 Reviewed-by: Volker Hilsheimer --- src/corelib/global/qlogging.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 28f3357e1b..0e9dd3b5ee 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1487,11 +1487,8 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con return message; } -static void qDefaultMsgHandler(QtMsgType type, const char *buf); static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &buf); -// pointer to QtMsgHandler debug handler (without context) -static QBasicAtomicPointer msgHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr); // pointer to QtMessageHandler debug handler (with context) static QBasicAtomicPointer messageHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr); @@ -1776,15 +1773,6 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con stderr_message_handler(type, context, message); } -/*! - \internal -*/ -static void qDefaultMsgHandler(QtMsgType type, const char *buf) -{ - QMessageLogContext emptyContext; - qDefaultMessageHandler(type, emptyContext, QString::fromLocal8Bit(buf)); -} - #if defined(Q_COMPILER_THREAD_LOCAL) static thread_local bool msgHandlerGrabbed = false; @@ -1826,14 +1814,8 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex // itself, e.g. by using Qt API if (grabMessageHandler()) { const auto ungrab = qScopeGuard([]{ ungrabMessageHandler(); }); - auto oldStyle = msgHandler.loadAcquire(); - auto newStye = messageHandler.loadAcquire(); - // prefer new message handler over the old one - if (newStye || !oldStyle) { - (newStye ? newStye : qDefaultMessageHandler)(msgType, context, message); - } else { - (oldStyle ? oldStyle : qDefaultMsgHandler)(msgType, message.toLocal8Bit().constData()); - } + auto msgHandler = messageHandler.loadAcquire(); + (msgHandler ? msgHandler : qDefaultMessageHandler)(msgType, context, message); } else { fprintf(stderr, "%s\n", message.toLocal8Bit().constData()); } -- cgit v1.2.3