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

Konstantin Pavlov thresh at videolan.org
Sun Feb 11 16:14:09 CET 2018


Hello,

On Sun, Feb 11, 2018 at 04:47:23PM +0200, RĂ©mi Denis-Courmont wrote:
> 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

That helps to avoid the crash on Debian 9, and make distcheck now works
nicely.

Thanks!

-- 
VideoLAN, Vice President
www.videolan.org
+7 926 165 45 31
@cryothresh


More information about the vlc-devel mailing list