Add custom Qt message handler for crashes.

This commit is contained in:
John Preston 2018-11-16 19:27:02 +04:00
parent 163ee73719
commit 478eeea73e

View File

@ -115,6 +115,21 @@ void InstallOperatorNewHandler() {
});
}
void InstallQtMessageHandler() {
static QtMessageHandler original = nullptr;
original = qInstallMessageHandler([](
QtMsgType type,
const QMessageLogContext &context,
const QString &message) {
if (original) {
original(type, context, message);
}
if (type == QtFatalMsg) {
Unexpected("Qt FATAL message was generated!");
}
});
}
Qt::HANDLE ReportingThreadId = nullptr;
bool ReportingHeaderWritten = false;
QMutex ReportingMutex;
@ -450,6 +465,7 @@ Status Restart() {
}
InstallOperatorNewHandler();
InstallQtMessageHandler();
return Started;
}