summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Krems <marcel@sarrazin.local>2019-09-15 17:51:21 +0200
committerMarcel Krems <m.krems@software-vision.eu>2020-08-29 16:24:21 +0200
commitab5e444c8fd754321ef0a6b084248e431e84a7a8 (patch)
treeadb5e99599e48b4a23545d2b00516fcf51ed4b25
parent2a896becdf500ce7f5db2d059b1445fb05a8c329 (diff)
Remove remaining traces of deprecated QtMsgHandler
Change-Id: I28aecb444eb9bc9e26e6ff8998904dbf28419f25 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/corelib/global/qlogging.cpp22
-rw-r--r--src/tools/uic/qclass_lib_map.h1
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp9
3 files changed, 2 insertions, 30 deletions
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<void (QtMsgType, const char*)> msgHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr);
// pointer to QtMessageHandler debug handler (with context)
static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> 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());
}
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 915f604158..4bd3051cf2 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -32,7 +32,6 @@ QT_CLASS_LIB(QIntegerForSize, QtCore, qglobal.h)
QT_CLASS_LIB(Q_INT64, QtCore, qglobal.h)
QT_CLASS_LIB(Q_UINT64, QtCore, qglobal.h)
QT_CLASS_LIB(QSysInfo, QtCore, qglobal.h)
-QT_CLASS_LIB(QtMsgHandler, QtCore, qglobal.h)
QT_CLASS_LIB(QGlobalStatic, QtCore, qglobal.h)
QT_CLASS_LIB(QGlobalStatic, QtCore, qglobal.h)
QT_CLASS_LIB(QGlobalStaticDeleter, QtCore, qglobal.h)
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 41458331a0..cf0fdef109 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -80,15 +80,6 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext &context, con
s_message = msg;
}
-void customMsgHandler(QtMsgType type, const char *msg)
-{
- s_type = type;
- s_file = 0;
- s_line = 0;
- s_function = 0;
- s_message = QString::fromLocal8Bit(msg);
-}
-
tst_qmessagehandler::tst_qmessagehandler()
{
// ensure it's unset, otherwise we'll have trouble