[vlc-commits] commit: Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe (Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont  | Sun Nov 21 
18:08:06 2010 +0200| [1c9669ac53e83beadcd112f909b239a9645b031c] | committer: 
Rémi Denis-Courmont 

Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe

All UI related operations in Qt4 must be done on the UI thread, as
QtGui is not thread-safe internally.

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

 modules/gui/qt4/qt4.cpp  |8 ++--
 modules/gui/qt4/util/qvlcapp.hpp |9 -
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 136995c..3f3beec 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -392,14 +392,10 @@ static void Close( vlc_object_t *p_this )
 }
 
 /* And quit */
-msg_Dbg( p_intf, "Please die, die, die..." );
-QApplication::closeAllWindows();
-
-//QApplication::quit();
-
+msg_Dbg( p_this, "requesting exit..." );
 QVLCApp::triggerQuit();
 
-msg_Dbg( p_intf, "Please die, die, die 2..." );
+msg_Dbg( p_this, "waiting for UI thread..." );
 #ifndef Q_WS_MAC
 vlc_join (p_sys->thread, NULL);
 #endif
diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index c9de99a..66fa024 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -40,10 +40,17 @@ class QVLCApp : public QApplication
 {
 Q_OBJECT
 
+private slots:
+void doQuit()
+{
+closeAllWindows();
+quit();
+}
+
 public:
 QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true )
 {
-connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
+connect( this, SIGNAL(quitSignal()), this, SLOT(doQuit()) );
 }
 
 static void triggerQuit()

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe (Rémi Denis-Courmont )

2010-11-21 Thread git
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont  | Sun Nov 
21 18:13:06 2010 +0200| [c2447f7d0721d91e16aac3fde829152f8ca35359] | committer: 
Rémi Denis-Courmont 

Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe

All UI related operations in Qt4 must be done on the UI thread, as
QtGui is not thread-safe internally.
(cherry picked from commit 1c9669ac53e83beadcd112f909b239a9645b031c)

Conflicts:

modules/gui/qt4/qt4.cpp

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

 modules/gui/qt4/qt4.cpp  |7 ++-
 modules/gui/qt4/util/qvlcapp.hpp |9 -
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 98d8aa6..aa7a182 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -359,13 +359,10 @@ static void Close( vlc_object_t *p_this )
 var_Destroy (pl_Get(p_this), "qt4-iface");
 
 /* And quit */
-msg_Dbg( p_intf, "Please die, die, die..." );
-QApplication::closeAllWindows();
-
-//QApplication::quit();
+msg_Dbg( p_this, "requesting exit..." );
 QVLCApp::triggerQuit();
 
-msg_Dbg( p_intf, "Please die, die, die 2..." );
+msg_Dbg( p_this, "waiting for UI thread..." );
 vlc_join (p_sys->thread, NULL);
 #ifdef Q_WS_X11
 free (x11_display);
diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index bfd8a90..3e016f2 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -40,10 +40,17 @@ class QVLCApp : public QApplication
 {
 Q_OBJECT
 
+private slots:
+void doQuit()
+{
+closeAllWindows();
+quit();
+}
+
 public:
 QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true )
 {
-connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
+connect( this, SIGNAL(quitSignal()), this, SLOT(doQuit()) );
 }
 
 static void triggerQuit()

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits