[PATCH] at qt4 termination, ensure quit() function is executed =

Erwan Tulou brezhoneg1 at yahoo.fr
Sat Mar 14 11:13:40 CET 2009


in the right thread=0A=
=0A=
---=0A=
 modules/gui/qt4/Modules.am       |    1 +=0A=
 modules/gui/qt4/qt4.cpp          |    2 +-=0A=
 modules/gui/qt4/qt4.hpp          |    4 ++--=0A=
 modules/gui/qt4/util/qvlcapp.hpp |   20 +++++++++++++++++++-=0A=
 4 files changed, 23 insertions(+), 4 deletions(-)=0A=
=0A=
diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am=0A=
index f118476..ce0f73e 100644=0A=
--- a/modules/gui/qt4/Modules.am=0A=
+++ b/modules/gui/qt4/Modules.am=0A=
@@ -57,6 +57,7 @@ nodist_SOURCES_qt4 =3D \=0A=
 		components/sout/sout_widgets.moc.cpp \=0A=
 		util/input_slider.moc.cpp \=0A=
 		util/customwidgets.moc.cpp \=0A=
+		util/qvlcapp.moc.cpp \=0A=
 		resources.cpp \=0A=
 		ui/equalizer.h \=0A=
 		ui/v4l2.h \=0A=
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp=0A=
index 3d4cda2..85ecda6 100644=0A=
--- a/modules/gui/qt4/qt4.cpp=0A=
+++ b/modules/gui/qt4/qt4.cpp=0A=
@@ -320,7 +320,7 @@ static void Close( vlc_object_t *p_this )=0A=
     intf_sys_t *p_sys =3D p_intf->p_sys;=0A=
 =0A=
     var_Destroy (p_this->p_libvlc, "qt4-iface");=0A=
-    QApplication::quit();=0A=
+    QVLCApp::triggerQuit();=0A=
 =0A=
     vlc_join (p_sys->thread, NULL);=0A=
 #ifdef Q_WS_X11=0A=
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp=0A=
index bfd8416..b3ba05c 100644=0A=
--- a/modules/gui/qt4/qt4.hpp=0A=
+++ b/modules/gui/qt4/qt4.hpp=0A=
@@ -52,7 +52,7 @@ enum {=0A=
     MsgEventType    =3D 300,=0A=
 };=0A=
 =0A=
-class QApplication;=0A=
+class QVLCApp;=0A=
 class QMenu;=0A=
 class MainInterface;=0A=
 class QSettings;=0A=
@@ -61,7 +61,7 @@ struct intf_sys_t=0A=
 {=0A=
     vlc_thread_t thread;=0A=
 =0A=
-    QApplication *p_app;     /* Main Qt Application */=0A=
+    QVLCApp *p_app;          /* Main Qt Application */=0A=
     MainInterface *p_mi;     /* Main Interface, NULL if DialogProvider =
Mode */=0A=
 =0A=
     QSettings *mainSettings; /* Qt State settings not messing main VLC =
ones */=0A=
diff --git a/modules/gui/qt4/util/qvlcapp.hpp =
b/modules/gui/qt4/util/qvlcapp.hpp=0A=
index b2a2ad6..905a415 100644=0A=
--- a/modules/gui/qt4/util/qvlcapp.hpp=0A=
+++ b/modules/gui/qt4/util/qvlcapp.hpp=0A=
@@ -30,13 +30,26 @@=0A=
 =0A=
 class QVLCApp : public QApplication=0A=
 {=0A=
+    Q_OBJECT=0A=
+=0A=
 public:=0A=
-    QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, =
true ) { }=0A=
+    QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, =
true )=0A=
+    {=0A=
+        connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );=0A=
+    }=0A=
+=0A=
+    static void triggerQuit()=0A=
+    {=0A=
+         QVLCApp *app =3D qobject_cast<QVLCApp*>( instance() );=0A=
+         if ( app )=0A=
+             emit app->quitSignal();=0A=
+    }=0A=
 =0A=
 #if defined (Q_WS_X11)=0A=
      QVLCApp( Display *dp, int & argc, char ** argv )=0A=
          : QApplication( dp, argc, argv )=0A=
      {=0A=
+        connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );=0A=
      }=0A=
 #endif=0A=
 =0A=
@@ -54,6 +67,11 @@ protected:=0A=
         return false;=0A=
     }=0A=
 #endif=0A=
+=0A=
+=0A=
+signals:=0A=
+    void quitSignal();=0A=
+=0A=
 };=0A=
 =0A=
 #endif=0A=
-- =0A=
1.5.2.5=0A=
=0A=

------=_NextPart_000_0015_01C9A510.48583590
Content-Type: application/octet-stream;
	name="0006-correct-lock-problem-since-playlist_CurrentInput-als.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="0006-correct-lock-problem-since-playlist_CurrentInput-als.patch"



More information about the vlc-devel mailing list