[vlc-commits] commit: Qt: fix WinXP quitting issue (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Fri Nov 19 03:02:55 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Nov 19 02:58:42 2010 +0100| [7f485998dd63c9685f0a470439c9b2ea127ef5c5] | committer: Jean-Baptiste Kempf 

Qt: fix WinXP quitting issue

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

 modules/gui/qt4/main_interface.cpp |   13 +++++++++----
 modules/gui/qt4/main_interface.hpp |    1 +
 modules/gui/qt4/qt4.cpp            |   17 +++++++++++------
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 3182775..5554aca 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -226,6 +226,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
 
+    CONNECT( this, askToQuit(), THEDP, quit() );
+
     /** END of CONNECTS**/
 
 
@@ -265,6 +267,8 @@ MainInterface::~MainInterface()
     if( stackCentralOldWidget == videoWidget )
         showTab( bgWidget );
 
+    releaseVideoSlot();
+
 #ifdef WIN32
     if( himl )
         ImageList_Destroy( himl );
@@ -597,7 +601,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 );
 
@@ -1180,9 +1185,9 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 
 void MainInterface::closeEvent( QCloseEvent *e )
 {
-    e->accept();
-    hide();
-    THEDP->quit();
+    e->ignore();      /* Do not quit */
+//  hide();
+    emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
 }
 
 void MainInterface::setInterfaceFullScreen( bool fs )
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index 5b55e76..4f7304e 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -244,6 +244,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 5a29d30..9e7519e 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -396,8 +396,15 @@ 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();
+
     QVLCApp::triggerQuit();
 
+    msg_Dbg( p_intf, "Please die, die, die 2..." );
 #ifndef Q_WS_MAC
     vlc_join (p_sys->thread, NULL);
 #endif
@@ -445,7 +452,7 @@ static void *Thread( void *obj )
 #endif
             QSettings::UserScope, "vlc", "vlc-qt-interface" );
 
-    /* Icon setting */
+    /* Icon setting, Mac uses icon from .icns */
 #ifndef Q_WS_MAC
     if( QDate::currentDate().dayOfYear() >= 352 ) /* One Week before Xmas */
         app.setWindowIcon( QIcon(vlc_christmas_xpm) );
@@ -456,7 +463,7 @@ static void *Thread( void *obj )
     /* Initialize timers and the Dialog Provider */
     DialogsProvider::getInstance( p_intf );
 
-    /* Detect screensize for small screens like TV or EEEpc*/
+    /* Detect screensize for small screens like TV or Netbooks */
     p_intf->p_sys->i_screenHeight =
         app.QApplication::desktop()->availableGeometry().height();
 
@@ -499,7 +506,7 @@ static void *Thread( void *obj )
 #endif
 
     /* Last settings */
-    app.setQuitOnLastWindowClosed( false );
+    app.setQuitOnLastWindowClosed( true );
 
     /* Retrieve last known path used in file browsing */
     p_intf->p_sys->filepath =
@@ -513,9 +520,7 @@ static void *Thread( void *obj )
     /* Launch */
     app.exec();
 
-    /* And quit */
-    QApplication::closeAllWindows();
-
+    msg_Dbg( p_intf, "QApp exec() finished" );
     if (p_mi != NULL)
     {
 #warning BUG!



More information about the vlc-commits mailing list