[vlc-devel] [PATCH] qt: use custom message handler for VLC Qt check

RĂ©mi Denis-Courmont remi at remlab.net
Sun Feb 11 15:47:23 CET 2018


Some versions of Qt abort the process on fatal error, possibly leading
core dumping. This installs a dummy handler that will exit the process
rather call abort() regardless of the Qt default handler.
---
 modules/gui/qt/vlc-qt-check.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/gui/qt/vlc-qt-check.cpp b/modules/gui/qt/vlc-qt-check.cpp
index 685238c88b..52a7f4a78b 100644
--- a/modules/gui/qt/vlc-qt-check.cpp
+++ b/modules/gui/qt/vlc-qt-check.cpp
@@ -22,9 +22,18 @@
 # include "config.h"
 #endif
 
+#include <stdlib.h>
 #include <QApplication>
 
+static void messageOutput(QtMsgType type, const QMessageLogContext &,
+                          const QString &)
+{
+    if (type == QtFatalMsg)
+        exit(1);
+}
+
 int main(int argc, char *argv[])
 {
+    qInstallMessageHandler(messageOutput);
     QApplication app(argc, argv);
 }
-- 
2.16.1



More information about the vlc-devel mailing list