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

Rémi Denis-Courmont git at videolan.org
Sun Feb 11 16:29:36 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 11 16:45:35 2018 +0200| [a60834c4746357449a5a961e0dbc4b0c3a74ad6f] | committer: Rémi Denis-Courmont

qt: use custom message handler for VLC Qt check

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a60834c4746357449a5a961e0dbc4b0c3a74ad6f
---

 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);
 }



More information about the vlc-commits mailing list