[vlc-commits] commit: Qt4: try again to fix the quitting issue (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Sat Nov 13 18:07:12 CET 2010


vlc/vlc-1.1 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Nov 13 18:05:27 2010 +0100| [6f4519c7c804a8f0e204ace4d130554c5da18d36] | committer: Jean-Baptiste Kempf 

Qt4: try again to fix the quitting issue

This seems to work on XP, 7 (32+64) and Linux (32+64)

I know it is a hack, but so far, this is the only solution I have found.

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

 modules/gui/qt4/components/interface_widgets.cpp |    2 ++
 modules/gui/qt4/main_interface.cpp               |   11 +++++++----
 modules/gui/qt4/main_interface.hpp               |    1 +
 modules/gui/qt4/qt4.cpp                          |   10 +++++++---
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index c930277..c615ace 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -173,6 +173,8 @@ void VideoWidget::release( void )
 {
     msg_Dbg( p_intf, "Video is not needed anymore" );
 
+    if(!stable)
+        return;
     assert( stable );
     layout->removeWidget( stable );
     stable->deleteLater();
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 5893d19..1bd3e63 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -223,6 +223,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
 
+    CONNECT( this, askToQuit(), THEDP, quit() );
     /** END of CONNECTS**/
 
 
@@ -263,6 +264,7 @@ MainInterface::~MainInterface()
     if( stackCentralOldWidget == videoWidget )
         showTab( bgWidget );
 
+    releaseVideoSlot();
 #ifdef WIN32
     if( himl )
         ImageList_Destroy( himl );
@@ -584,7 +586,8 @@ void MainInterface::releaseVideo( void )
 /* Function that is CONNECTED to the previous emit */
 void MainInterface::releaseVideoSlot( void )
 {
-    videoWidget->release();
+    if( videoWidget )
+        videoWidget->release();
     setVideoOnTop( false );
     setVideoFullScreen( false );
 
@@ -1130,9 +1133,9 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 
 void MainInterface::closeEvent( QCloseEvent *e )
 {
-    e->accept();
-    hide();
-    THEDP->quit();
+    //hide();
+    e->ignore();
+    emit askToQuit();
 }
 
 void MainInterface::setInterfaceFullScreen( bool fs )
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index e2a5985..4f4d208 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -235,6 +235,7 @@ signals:
     void askVideoOnTop( bool );
     void minimalViewToggled( bool );
     void fullscreenInterfaceToggled( bool );
+    void askToQuit();
 
 };
 
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 0213ad7..5ed7682 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -365,8 +365,14 @@ static void Close( vlc_object_t *p_this )
     if( !p_sys->b_isDialogProvider )
         var_Destroy (pl_Get(p_this), "qt4-iface");
 
+    /* And quit */
+    msg_Dbg( p_intf, "Please die, die, die..." );
+    QApplication::closeAllWindows();
+
+//    QApplication::quit();
     QVLCApp::triggerQuit();
 
+    msg_Dbg( p_intf, "Please die, die, die 2..." );
     vlc_join (p_sys->thread, NULL);
 #ifdef Q_WS_X11
     free (x11_display);
@@ -469,9 +475,7 @@ static void *Thread( void *obj )
     /* Launch */
     app.exec();
 
-    /* And quit */
-    QApplication::closeAllWindows();
-
+    msg_Dbg( p_intf, "Exec finished()" );
     if (p_mi != NULL)
     {
 #warning BUG!



More information about the vlc-commits mailing list