#include <stdio.h>
#include <stdlib.h>
-void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const char *msg)
+void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
+ QByteArray localMsg = msg.toLocal8Bit();
switch (type) {
case QtDebugMsg:
- fprintf(stderr, "Debug: %s (%s:%u, %s)\n", msg, context.file, context.line, context.function);
+ fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtWarningMsg:
- fprintf(stderr, "Warning: %s (%s:%u, %s)\n", msg, context.file, context.line, context.function);
+ fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtCriticalMsg:
- fprintf(stderr, "Critical: %s (%s:%u, %s)\n", msg, context.file, context.line, context.function);
+ fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtFatalMsg:
- fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", msg, context.file, context.line, context.function);
+ fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
abort();
}
}
Finally, the QtMsgType definition identifies the various messages
that can be generated and sent to a Qt message handler;
- QMessageHandler is a type definition for a pointer to a function with
+ QtMessageHandler is a type definition for a pointer to a function with
the signature
\c {void myMessageHandler(QtMsgType, const QMessageLogContext &, const char *)}.
QMessageLogContext class contains the line, file, and function the
accept a \l qreal value as their argument returning the value
rounded up to the nearest integer and 64-bit integer respectively,
the qInstallMessageHandler() function which installs the given
- QMessageHandler, and the qVersion() function which returns the
+ QtMessageHandler, and the qVersion() function which returns the
version number of Qt at run-time as a string.
\section1 Macros
\value QtSystemMsg
- \sa QMessageHandler, qInstallMessageHandler()
+ \sa QtMessageHandler, qInstallMessageHandler()
*/
/*! \typedef QFunctionPointer
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
- This typedef is deprecated, you should use QMessageHandler instead.
- \sa QtMsgType, QMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
+ This typedef is deprecated, you should use QtMessageHandler instead.
+ \sa QtMsgType, QtMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
*/
/*!
- \typedef QMessageHandler
+ \typedef QtMessageHandler
\relates <QtGlobal>
\since 5.0
*/
/*!
- \fn QMessageHandler qInstallMessageHandler(QMessageHandler handler)
+ \fn QtMessageHandler qInstallMessageHandler(QtMessageHandler handler)
\relates <QtGlobal>
\since 5.0
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
- \sa QMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
+ \sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
{Debugging Techniques}
*/
#include "qcoreapplication.h"
#include "qthread.h"
#endif
-#ifdef Q_OS_WINCE
+#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
The class provides information about the source code location a qDebug(), qWarning(),
qCritical() or qFatal() message was generated.
- \sa QMessageLogger, QMessageHandler, qInstallMessageHandler()
+ \sa QMessageLogger, QtMessageHandler, qInstallMessageHandler()
*/
/*!
\internal
Uses a local buffer to output the message. Not locale safe + cuts off
everything after character 255, but will work in out of memory situations.
+ Stop the execution afterwards.
*/
static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap)
{
emergency_buf[255] = '\0';
if (msg)
qvsnprintf(emergency_buf, 255, msg, ap);
- QMessageLogContext context;
- qt_message_output(msgType, context, emergency_buf);
+
+#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
+ OutputDebugStringA(emergency_buf);
+#else
+ fprintf(stderr, "%s", emergency_buf);
+ fflush(stderr);
+#endif
+
+ if (msgType == QtFatalMsg
+ || (msgType == QtWarningMsg
+ && (!qgetenv("QT_FATAL_WARNINGS").isNull())) ) {
+#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
+ // get the current report mode
+ int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW);
+ _CrtSetReportMode(_CRT_ERROR, reportMode);
+ int ret = _CrtDbgReport(_CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR,
+ msg);
+ if (ret == 1)
+ _CrtDbgBreak();
+#endif
+
+#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
+ abort(); // trap; generates core dump
+#else
+ exit(1); // goodbye cruel world
+#endif
+ }
}
#endif
return;
}
#endif
- QByteArray buf;
+ QString buf;
if (msg) {
QT_TRY {
- buf = QString().vsprintf(msg, ap).toLocal8Bit();
+ buf = QString().vsprintf(msg, ap);
} QT_CATCH(const std::bad_alloc &) {
#if !defined(QT_NO_EXCEPTIONS)
qEmergencyOut(msgType, msg, ap);
#endif
}
}
- qt_message_output(msgType, context, buf.constData());
+ qt_message_output(msgType, context, buf);
}
#undef qDebug
else {
fprintf(stderr, "%s\n",
QString::fromLatin1("QT_MESSAGE_PATTERN: Unknown placeholder %1\n"
- ).arg(lexeme).toLocal8Bit().constData());
+ ).arg(lexeme).toLatin1().constData());
fflush(stderr);
tokens[i] = emptyTokenC;
}
} else {
char *literal = new char[lexeme.size() + 1];
- strncpy(literal, lexeme.toLocal8Bit().constData(), lexeme.size());
+ strncpy(literal, lexeme.toLatin1().constData(), lexeme.size());
literal[lexeme.size()] = '\0';
literalsVar.append(literal);
tokens[i] = literal;
/*!
\internal
*/
-Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type, const QMessageLogContext &context,
- const char *str)
+Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context,
+ const QString &str)
{
- QByteArray message;
+ QString message;
QMessagePattern *pattern = qMessagePattern();
if (!pattern) {
// after destruction of static QMessagePattern instance
message.append(str);
- message.append('\n');
+ message.append(QLatin1Char('\n'));
return message;
}
if (token == messageTokenC) {
message.append(str);
} else if (token == categoryTokenC) {
- message.append(context.category);
+ message.append(QLatin1String(context.category));
} else if (token == typeTokenC) {
switch (type) {
- case QtDebugMsg: message.append("debug"); break;
- case QtWarningMsg: message.append("warning"); break;
- case QtCriticalMsg:message.append("critical"); break;
- case QtFatalMsg: message.append("fatal"); break;
+ case QtDebugMsg: message.append(QLatin1String("debug")); break;
+ case QtWarningMsg: message.append(QLatin1String("warning")); break;
+ case QtCriticalMsg:message.append(QLatin1String("critical")); break;
+ case QtFatalMsg: message.append(QLatin1String("fatal")); break;
}
} else if (token == fileTokenC) {
if (context.file)
- message.append(context.file);
+ message.append(QLatin1String(context.file));
else
- message.append("unknown");
+ message.append(QLatin1String("unknown"));
} else if (token == lineTokenC) {
- message.append(QByteArray::number(context.line));
+ message.append(QString::number(context.line));
} else if (token == functionTokenC) {
if (context.function)
- message.append(qCleanupFuncinfo(context.function));
+ message.append(QString::fromLatin1(qCleanupFuncinfo(context.function)));
else
- message.append("unknown");
+ message.append(QLatin1String("unknown"));
#ifndef QT_BOOTSTRAPPED
} else if (token == pidTokenC) {
- message.append(QByteArray::number(QCoreApplication::applicationPid()));
+ message.append(QString::number(QCoreApplication::applicationPid()));
} else if (token == appnameTokenC) {
- message.append(QCoreApplication::applicationName().toUtf8().constData());
+ message.append(QCoreApplication::applicationName());
} else if (token == threadidTokenC) {
- message.append("0x" + QByteArray::number(qlonglong(QThread::currentThread()->currentThread()), 16));
+ message.append(QLatin1String("0x"));
+ message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16));
#endif
} else {
- message.append(token);
+ message.append(QLatin1String(token));
}
}
- message.append('\n');
+ message.append(QLatin1Char('\n'));
return message;
}
static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context)
-static QMessageHandler messageHandler = 0; // pointer to debug handler (with context)
+static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context)
+static QMessageHandler messageHandler2 = 0; // TODO: Remove before Qt5.0 beta
/*!
\internal
*/
static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context,
- const char *buf)
+ const QString &buf)
{
- QByteArray logMessage = qMessageFormatString(type, context, buf);
+ QString logMessage = qMessageFormatString(type, context, buf);
#if defined(Q_OS_WINCE)
- QString fstr = QString::fromLocal8Bit(logMessage);
- OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16()));
+ OutputDebugString(reinterpret_cast<const wchar_t *> (logMessage.utf16()));
#else
- fprintf(stderr, "%s", logMessage.constData());
+ fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
fflush(stderr);
#endif
}
/*!
\internal
*/
+static void qDefaultMessageHandler2(QtMsgType type, const QMessageLogContext &context,
+ const char *buf)
+{
+ qDefaultMessageHandler(type, context, QString::fromLocal8Bit(buf));
+}
+
+/*!
+ \internal
+*/
static void qDefaultMsgHandler(QtMsgType type, const char *buf)
{
QMessageLogContext emptyContext;
- qDefaultMessageHandler(type, emptyContext, buf);
+ qDefaultMessageHandler(type, emptyContext, QLatin1String(buf));
}
/*!
\internal
*/
-void qt_message_output(QtMsgType msgType, const QMessageLogContext &context, const char *buf)
+void qt_message_output(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
{
if (!msgHandler)
msgHandler = qDefaultMsgHandler;
if (!messageHandler)
messageHandler = qDefaultMessageHandler;
+ if (!messageHandler2)
+ messageHandler2 = qDefaultMessageHandler2;
+
+ if (messageHandler == qDefaultMessageHandler
+ && messageHandler2 != qDefaultMessageHandler2)
+ (*messageHandler2)(msgType, context, message.toLocal8Bit().constData());
// prefer new message handler over the old one
if (msgHandler == qDefaultMsgHandler
|| messageHandler != qDefaultMessageHandler) {
- (*messageHandler)(msgType, context, buf);
+ (*messageHandler)(msgType, context, message);
} else {
- (*msgHandler)(msgType, buf);
+ (*msgHandler)(msgType, message.toLocal8Bit().constData());
}
if (msgType == QtFatalMsg
// get the current report mode
int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW);
_CrtSetReportMode(_CRT_ERROR, reportMode);
-#if !defined(Q_OS_WINCE)
- int ret = _CrtDbgReport(_CRT_ERROR, context.file, context.line, QT_VERSION_STR, buf);
-#else
- int ret = _CrtDbgReportW(_CRT_ERROR, _CRT_WIDE(context.file),
+
+ int ret = _CrtDbgReportW(_CRT_ERROR, reinterpret_cast<const wchar_t *> (
+ QString::fromLatin1(context.file).utf16()),
context.line, _CRT_WIDE(QT_VERSION_STR),
reinterpret_cast<const wchar_t *> (
- QString::fromLatin1(buf).utf16()));
-#endif
+ message.utf16()));
if (ret == 0 && reportMode & _CRTDBG_MODE_WNDW)
return; // ignore
else if (ret == 1)
buf.vsprintf(msg, ap);
va_end(ap);
- QMessageLogger().critical("%s (%s)", buf.toLocal8Bit().constData(),
- qt_error_string(-1).toLocal8Bit().constData());
+ buf += QLatin1String(" (") + qt_error_string(-1) + QLatin1Char(')');
+ QMessageLogContext context;
+ qt_message_output(QtCriticalMsg, context, buf);
}
void qErrnoWarning(int code, const char *msg, ...)
buf.vsprintf(msg, ap);
va_end(ap);
- QMessageLogger().critical("%s (%s)", buf.toLocal8Bit().constData(),
- qt_error_string(code).toLocal8Bit().constData());
+ buf += QLatin1String(" (") + qt_error_string(code) + QLatin1Char(')');
+ QMessageLogContext context;
+ qt_message_output(QtCriticalMsg, context, buf);
}
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
extern bool usingWinMain;
extern Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char *str);
extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context,
- const char *str);
+ const QString &str);
+
+void qWinMessageHandler2(QtMsgType t, const QMessageLogContext &context,
+ const char *str)
+{
+ qWinMessageHandler(t, context, QString::fromLocal8Bit(str));
+}
#endif
-QMessageHandler qInstallMessageHandler(QMessageHandler h)
+QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
{
if (!messageHandler)
messageHandler = qDefaultMessageHandler;
- QMessageHandler old = messageHandler;
+ QtMessageHandler old = messageHandler;
messageHandler = h;
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
if (!messageHandler && usingWinMain)
return old;
}
+QMessageHandler qInstallMessageHandler(QMessageHandler h)
+{
+ if (!messageHandler2)
+ messageHandler2 = qDefaultMessageHandler2;
+ QMessageHandler old = messageHandler2;
+ messageHandler2 = h;
+#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
+ if (!messageHandler2 && usingWinMain)
+ messageHandler2 = qWinMessageHandler2;
+#endif
+ return old;
+}
+
QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
{
//if handler is 0, set it to the
# define qWarning QT_NO_QWARNING_MACRO
#endif
-Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context, const char *buf);
+Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context,
+ const QString &message);
Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
typedef void (*QtMsgHandler)(QtMsgType, const char *);
Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
+typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &);
+Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);
+
+// TODO: Remove before Qt5.0 Beta
typedef void (*QMessageHandler)(QtMsgType, const QMessageLogContext &, const char *);
Q_CORE_EXPORT QMessageHandler qInstallMessageHandler(QMessageHandler);
QT_TRY {
qt_message_output(stream->type,
stream->context,
- stream->buffer.toLocal8Bit().data());
+ stream->buffer);
} QT_CATCH(std::bad_alloc&) { /* We're out of memory - give up. */ }
}
delete stream;
};
// defined in qlogging.cpp
-extern Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type,
- const QMessageLogContext &context,
- const char *str);
+extern Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type,
+ const QMessageLogContext &context,
+ const QString &str);
-Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context, const char *str)
+Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context, const QString &str)
{
// cannot use QMutex here, because qWarning()s in the QMutex
// implementation may cause this function to recurse
static QWinMsgHandlerCriticalSection staticCriticalSection;
- QByteArray message = qMessageFormatString(t, context, str);
- QString s(QString::fromLocal8Bit(message));
+ QString message = qMessageFormatString(t, context, str);
// OutputDebugString is not threadsafe.
staticCriticalSection.lock();
- OutputDebugString((wchar_t*)s.utf16());
+ OutputDebugString((wchar_t*)message.utf16());
staticCriticalSection.unlock();
}
Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char *str)
{
QMessageLogContext emptyContext;
- qWinMessageHandler(t, emptyContext, str);
+ qWinMessageHandler(t, emptyContext, QString::fromLocal8Bit(str));
}
/*****************************************************************************
usingWinMain = true;
// Install default debug handler
- qInstallMsgHandler(qWinMsgHandler);
+ qInstallMessageHandler(qWinMessageHandler);
// Create command line
argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc);
const char *s_function;
static QString s_message;
-void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const char *msg)
+void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
s_type = type;
s_file = context.file;
s_line = context.line;
s_function = context.function;
- s_message = QString::fromLocal8Bit(msg);
+ s_message = msg;
}
void customMsgHandler(QtMsgType type, const char *msg)
void tst_qmessagehandler::cleanup()
{
qInstallMsgHandler(0);
- qInstallMessageHandler(0);
+ qInstallMessageHandler((QtMessageHandler)0);
s_type = QtFatalMsg;
s_file = 0;
s_line = 0;
void tst_qmessagehandler::installMessageHandler()
{
- QMessageHandler oldHandler = qInstallMessageHandler(customMessageHandler);
+ QtMessageHandler oldHandler = qInstallMessageHandler(customMessageHandler);
qDebug("installMessageHandler"); int line = __LINE__;
QCOMPARE(s_function, Q_FUNC_INFO);
QCOMPARE(s_line, line);
- QMessageHandler myHandler = qInstallMessageHandler(oldHandler);
+ QtMessageHandler myHandler = qInstallMessageHandler(oldHandler);
QCOMPARE((void*)myHandler, (void*)customMessageHandler);
}
}
static QtMsgType s_msgType;
-static QByteArray s_msg;
+static QString s_msg;
static QByteArray s_file;
static int s_line;
static QByteArray s_function;
-static void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const char *msg)
+static void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
s_msg = msg;
s_msgType = type;
class MessageHandlerSetter
{
public:
- MessageHandlerSetter(QMessageHandler newMessageHandler)
+ MessageHandlerSetter(QtMessageHandler newMessageHandler)
: oldMessageHandler(qInstallMessageHandler(newMessageHandler))
{ }
}
private:
- QMessageHandler oldMessageHandler;
+ QtMessageHandler oldMessageHandler;
};
/*! \internal
{ qWarning() << "A qWarning() message"; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtWarningMsg);
- QCOMPARE(QString::fromLatin1(s_msg.data()), QString::fromLatin1("A qWarning() message "));
+ QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
{ qCritical() << "A qCritical() message"; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtCriticalMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("A qCritical() message "));
+ QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
{ qDebug() << false << true; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("false true "));
+ QCOMPARE(s_msg, QString::fromLatin1("false true "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
}
QString file = __FILE__; int line = __LINE__ - 2; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtWarningMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("Test output:\n")+test+QString::fromLatin1("\nend"));
+ QCOMPARE(s_msg, QString::fromLatin1("Test output:\n")+test+QString::fromLatin1("\nend"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
{ qDebug() << inRef; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("\"input\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"input\" "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
{ qDebug() << inRef; }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("\"\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"\" "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
{ qDebug() << QLatin1String("foo") << QLatin1String("") << QLatin1String("barbaz", 3); }
QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO;
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(QString::fromLatin1(s_msg), QString::fromLatin1("\"foo\" \"\" \"bar\" "));
+ QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\" "));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
void tst_QDebug::defaultMessagehandler() const
{
MessageHandlerSetter mhs(0);
- QMessageHandler defaultMessageHandler1 = qInstallMessageHandler(0);
- QMessageHandler defaultMessageHandler2 = qInstallMessageHandler(myMessageHandler);
+ QtMessageHandler defaultMessageHandler1 = qInstallMessageHandler((QtMessageHandler)0);
+ QtMessageHandler defaultMessageHandler2 = qInstallMessageHandler(myMessageHandler);
bool same = (*defaultMessageHandler1 == *defaultMessageHandler2);
QVERIFY(same);
- QMessageHandler messageHandler = qInstallMessageHandler(0);
+ QtMessageHandler messageHandler = qInstallMessageHandler((QtMessageHandler)0);
same = (*messageHandler == *myMessageHandler);
QVERIFY(same);
}