]> git.sesse.net Git - vlc/commitdiff
at qt4 termination, ensure quit() function is executed in the right thread
authorErwan Tulou <brezhoneg1@yahoo.fr>
Sat, 14 Mar 2009 10:13:40 +0000 (11:13 +0100)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 17 Mar 2009 16:11:32 +0000 (18:11 +0200)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/gui/qt4/Modules.am
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp
modules/gui/qt4/util/qvlcapp.hpp

index f118476d5b707842982e82ec5082e4c119e66fcc..ce0f73e62cd9b8a9c9c5d8ab8bba1e96e3c4d703 100644 (file)
@@ -57,6 +57,7 @@ nodist_SOURCES_qt4 = \
                components/sout/sout_widgets.moc.cpp \
                util/input_slider.moc.cpp \
                util/customwidgets.moc.cpp \
+               util/qvlcapp.moc.cpp \
                resources.cpp \
                ui/equalizer.h \
                ui/v4l2.h \
index 7a07f7116360fe7d336fadc133c688438d984f65..5aae67ca08d3b7d72e22edcd712f53696a9f0ccd 100644 (file)
@@ -329,7 +329,7 @@ static void Close( vlc_object_t *p_this )
     intf_sys_t *p_sys = p_intf->p_sys;
 
     var_Destroy (p_this->p_libvlc, "qt4-iface");
-    QApplication::quit();
+    QVLCApp::triggerQuit();
 
     vlc_join (p_sys->thread, NULL);
 #ifdef Q_WS_X11
index 62a26c5dfddb360775539feccb79fd0dec0eba64..9077cb900d23a4a027e9abe291e8d3e1bb5963ad 100644 (file)
@@ -52,7 +52,7 @@ enum {
     MsgEventType    = 300,
 };
 
-class QApplication;
+class QVLCApp;
 class QMenu;
 class MainInterface;
 class QSettings;
@@ -61,7 +61,7 @@ struct intf_sys_t
 {
     vlc_thread_t thread;
 
-    QApplication *p_app;     /* Main Qt Application */
+    QVLCApp *p_app;          /* Main Qt Application */
     MainInterface *p_mi;     /* Main Interface, NULL if DialogProvider Mode */
 
     QSettings *mainSettings; /* Qt State settings not messing main VLC ones */
index b2a2ad61a55dfd2466e3bf872383b6e5d5d4b0aa..905a4155dae5fc71c01dfc259c8794293d664066 100644 (file)
 
 class QVLCApp : public QApplication
 {
+    Q_OBJECT
+
 public:
-    QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true ) { }
+    QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true )
+    {
+        connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
+    }
+
+    static void triggerQuit()
+    {
+         QVLCApp *app = qobject_cast<QVLCApp*>( instance() );
+         if ( app )
+             emit app->quitSignal();
+    }
 
 #if defined (Q_WS_X11)
      QVLCApp( Display *dp, int & argc, char ** argv )
          : QApplication( dp, argc, argv )
      {
+        connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
      }
 #endif
 
@@ -54,6 +67,11 @@ protected:
         return false;
     }
 #endif
+
+
+signals:
+    void quitSignal();
+
 };
 
 #endif