]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
Qt: Fix "chapter buttons not hiding when stop is clicked" issue
[vlc] / modules / gui / qt4 / qt4.cpp
index 3beeb3e45f7a3453173512b8975d386333791086..59ea6810f6cf7db1547d4c45c784d6c5ec766441 100644 (file)
@@ -239,6 +239,7 @@ static int Open( vlc_object_t *p_this )
     memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
 
     p_intf->pf_run = Run;
+    p_intf->p_sys->p_mi = NULL;
 
     /* Access to the playlist */
     p_intf->p_sys->p_playlist = pl_Yield( p_intf );
@@ -271,9 +272,12 @@ static void Close( vlc_object_t *p_this )
 
     if( p_intf->p_sys->b_isDialogProvider )
     {
-        DialogEvent *event = new DialogEvent( INTF_DIALOG_EXIT, 0, NULL );
-        QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
-
+        if( DialogsProvider::isAlive() )
+        {
+            msg_Dbg( p_intf, "Asking the DP to quit nicely" );
+            DialogEvent *event = new DialogEvent( INTF_DIALOG_EXIT, 0, NULL );
+            QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
+        }
         vlc_thread_join( p_intf );
     }
 
@@ -389,7 +393,7 @@ static void *Init( vlc_object_t *obj )
 #   if defined (WIN32) || defined (__APPLE__)
     char* psz_tmp = config_GetPsz( p_intf, "language" );
     QString lang = qfu( psz_tmp );
-    free( psz_tmp;
+    free( psz_tmp);
     if (lang == "auto")
         lang = QLocale::system().name();
 #   else
@@ -423,6 +427,7 @@ static void *Init( vlc_object_t *obj )
     app->exec();
 
     /* And quit */
+    msg_Dbg( p_intf, "Quitting the Qt4 Interface" );
 
     if (miP)
     {
@@ -441,16 +446,19 @@ static void *Init( vlc_object_t *obj )
        in the MainInputManager */
     delete p_intf->p_sys->p_mi;
 
-    /* Destroy then other windows, because some are connected to some slots
-       in the MainInputManager */
+    /* Destroy all remaining windows,
+       because some are connected to some slots
+       in the MainInputManager
+       Settings must be destroyed after that.
+     */
     DialogsProvider::killInstance();
 
+    /* Delete the configuration. Application has to be deleted after that. */
+    delete p_intf->p_sys->mainSettings;
+
     /* Destroy the MainInputManager */
     MainInputManager::killInstance();
 
-    /* Delete the configuration */
-    delete p_intf->p_sys->mainSettings;
-
     /* Delete the application */
     delete app;