Cause fatal errors to trigger a crashpad crash on Windows release builds.

This is needed because Qt changed from `std::abort` to `__fastfail`,
which can't be caught by crashpad.
This commit is contained in:
Mat Sutcliffe
2019-03-29 22:54:44 +00:00
parent 057031293d
commit 1089adf18d

View File

@@ -14,6 +14,10 @@
#include "blackmisc/worker.h"
#include "blackconfig/buildconfig.h"
#ifdef BLACK_USE_CRASHPAD
#include "crashpad/client/simulate_crash.h"
#endif
#include <QCoreApplication>
#include <QGlobalStatic>
#include <QMessageLogContext>
@@ -44,7 +48,13 @@ namespace BlackMisc
const CStatusMessage statusMessage(type, context, message);
const auto invokee = [statusMessage] { CLogHandler::instance()->logLocalMessage(statusMessage); };
#if defined(Q_CC_MSVC) && defined(QT_NO_DEBUG)
if (type == QtFatalMsg) { MessageBoxW(nullptr, message.toStdWString().c_str(), nullptr, MB_OK); }
if (type == QtFatalMsg)
{
MessageBoxW(nullptr, message.toStdWString().c_str(), nullptr, MB_OK); // display assert dialog in release build
# if defined(BLACK_USE_CRASHPAD)
CRASHPAD_SIMULATE_CRASH(); // workaround inability to catch __fastfail
# endif
}
#endif
if (type == QtFatalMsg && CLogHandler::instance()->thread() != QThread::currentThread())
{