Make qFatal() trigger the crash reporter on Windows
authorDominik Schmidt <dev@dominik-schmidt.de>
Wed, 31 Oct 2018 12:21:41 +0000 (13:21 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 1 Jul 2020 12:54:32 +0000 (14:54 +0200)
src/libsync/logger.cpp

index 91446553e35041510672fee54f85c034028920c3..b5c0dfbab309161d7e31ed01061dadfd512da572 100644 (file)
@@ -19,6 +19,7 @@
 #include <QDir>
 #include <QStringList>
 #include <QThread>
+#include <QtGlobal>
 #include <qmetaobject.h>
 
 #include <zlib.h>
@@ -37,6 +38,13 @@ static void mirallLogCatcher(QtMsgType type, const QMessageLogContext &ctx, cons
     } else if (!logger->isNoop()) {
         logger->doLog(qFormatLogMessage(type, ctx, message));
     }
+
+#if defined(Q_OS_WIN)
+    // Make application terminate in a way that can be caught by the crash reporter
+    if(type == QtFatalMsg) {
+        Utility::crash();
+    }
+#endif
 }