Remove remaining traces of deprecated QtMsgHandler
Change-Id: I28aecb444eb9bc9e26e6ff8998904dbf28419f25 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
2a896becdf
commit
ab5e444c8f
@ -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());
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user