[libmediaart: 1/2] Fix Qt5 backend crashing when running in Qt application




commit b13dec2952c1e426cb36a964f1c7312b9c4ec4f5
Author: Pekka Vuorela <pekka vuorela jolla com>
Date:   Wed Apr 22 17:43:06 2020 +0300

    Fix Qt5 backend crashing when running in Qt application
    
    Creating a dummy QCoreApplication instance is bad in itself,
    but even worse when running in an app that already has one.

 libmediaart/extractqt.cpp | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/libmediaart/extractqt.cpp b/libmediaart/extractqt.cpp
index 6114270..580f3dd 100644
--- a/libmediaart/extractqt.cpp
+++ b/libmediaart/extractqt.cpp
@@ -59,6 +59,10 @@ media_art_plugin_init (gint max_width)
        max_width_in_bytes = max_width;
 
 #ifdef HAVE_QT5
+       if (QCoreApplication::instance()) {
+               // avoid a new instance if already running inside a qt app
+               return;
+       }
        app = new QCoreApplication (argc, argv);
 #else  /* HAVE_QT4 (we fallback to Qt4) */
        app = new QApplication (argc, argv, QApplication::Tty);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]