]> git.sesse.net Git - vlc/commitdiff
Qt4 - Try to improve quitting of the application... Ref #1397
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 19 Jan 2008 03:52:25 +0000 (03:52 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 19 Jan 2008 03:52:25 +0000 (03:52 +0000)
modules/gui/qt4/dialogs/open.hpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/qt4.cpp

index 7bdf45ffac30dc93b6b10ecd8f329e09ff3a51dd..fa9e46f06eb36d5680b55f18418e1fc60de78d89 100644 (file)
@@ -42,6 +42,11 @@ public:
     static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf,
                                      int _action_flag = 0, bool modal = false  );
 
+    static void killInstance()
+    {
+        if( instance ) delete instance;
+        instance = NULL;
+    }
     virtual ~OpenDialog();
 
     void showTab( int );
index 3a6b86fb6c9638077925d77cebde9c83616bc37a..4776b002b1ef20d5faf5a485022e2fd03627540d 100644 (file)
@@ -112,7 +112,7 @@ public:
     static void killInstance()
     {
         if( instance ) delete instance;
-        instance=NULL;
+        instance = NULL;
     }
     virtual ~DialogsProvider();
     QTimer *fixed_timer;
index 129d545fb3d98c249186b796d36de015e43e3266..4827a925ee34d3da907de7e8ec5b59e36910d9df 100644 (file)
@@ -213,7 +213,6 @@ void InputManager::customEvent( QEvent *event )
          delInput();
          return;
     }
-         
 
     IMEvent *ime = static_cast<IMEvent *>(event);
 
@@ -288,7 +287,7 @@ void InputManager::UpdateRate( void )
          i_rate = i_new_rate;
          /* Update rate */
          emit rateChanged( i_rate );
-     } 
+     }
 }
 
 void InputManager::UpdateMeta( void )
@@ -479,8 +478,8 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
 
 MainInputManager::~MainInputManager()
 {
-    if( p_input ) 
-    { 
+    if( p_input )
+    {
        vlc_object_release( p_input );
        emit inputChanged( NULL );
     }
@@ -500,7 +499,7 @@ void MainInputManager::customEvent( QEvent *event )
         emit volumeChanged();
         return;
     }
-    
+
     if( VLC_OBJECT_INTF == p_intf->i_object_type )
     {
         vlc_mutex_lock( &p_intf->change_lock );
index de9f8e2f1e32bbf860c3ee2095a2bd277871c31b..7ea393f475cdb872fc2b7a56a60204c47c1076ba 100644 (file)
@@ -1132,9 +1132,7 @@ void MainInterface::wheelEvent( QWheelEvent *e )
 void MainInterface::closeEvent( QCloseEvent *e )
 {
     hide();
-    vlc_object_kill( p_intf );
-    QApplication::closeAllWindows();
-    QApplication::quit();
+    THEDP->quit();
 }
 
 /*****************************************************************************
index 221e9cf94d941ada7fccef7f13f0c6a64a7495ef..4db396fdf38830273069e6bd1bf531600b08b9fc 100644 (file)
@@ -289,7 +289,6 @@ static void Init( intf_thread_t *p_intf )
         p_mi->show();
     }
     else
-    /*if( p_intf->pf_show_dialog )*/
         vlc_thread_ready( p_intf );
 
 #ifdef ENABLE_NLS
@@ -327,8 +326,18 @@ static void Init( intf_thread_t *p_intf )
     app->exec();
 
     /* And quit */
-    MainInputManager::killInstance();
+
+    /* Destroy first the main interface because it is connected to some slots
+       in the MainInputManager */
+    if( p_intf->p_sys->p_mi ) delete p_intf->p_sys->p_mi;
+
+    /* Destroy then other windows, because some are connected to some slots
+       in the MainInputManager */
     DialogsProvider::killInstance();
+
+    /* Destroy the MainInputManager */
+    MainInputManager::killInstance();
+
     delete app;
 }