mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Reorder log handler thread check to happen before the Win32 messagebox
This commit is contained in:
@@ -47,6 +47,13 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
const CStatusMessage statusMessage(type, context, message);
|
const CStatusMessage statusMessage(type, context, message);
|
||||||
const auto invokee = [statusMessage] { CLogHandler::instance()->logLocalMessage(statusMessage); };
|
const auto invokee = [statusMessage] { CLogHandler::instance()->logLocalMessage(statusMessage); };
|
||||||
|
if (type == QtFatalMsg && CLogHandler::instance()->thread() != QThread::currentThread())
|
||||||
|
{
|
||||||
|
// Fatal message means this thread is about to crash the application. A queued connection would be useless.
|
||||||
|
// Blocking queued connection means we pause this thread just long enough to let the main thread handle the message.
|
||||||
|
QMetaObject::invokeMethod(CLogHandler::instance(), invokee, Qt::BlockingQueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if defined(Q_CC_MSVC) && defined(QT_NO_DEBUG)
|
#if defined(Q_CC_MSVC) && defined(QT_NO_DEBUG)
|
||||||
if (type == QtFatalMsg)
|
if (type == QtFatalMsg)
|
||||||
{
|
{
|
||||||
@@ -56,13 +63,6 @@ namespace BlackMisc
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (type == QtFatalMsg && CLogHandler::instance()->thread() != QThread::currentThread())
|
|
||||||
{
|
|
||||||
// Fatal message means this thread is about to crash the application. A queued connection would be useless.
|
|
||||||
// Blocking queued connection means we pause this thread just long enough to let the main thread handle the message.
|
|
||||||
QMetaObject::invokeMethod(CLogHandler::instance(), invokee, Qt::BlockingQueuedConnection);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QMetaObject::invokeMethod(CLogHandler::instance(), invokee);
|
QMetaObject::invokeMethod(CLogHandler::instance(), invokee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user