]> git.sesse.net Git - vlc/commitdiff
qt4: a few stability fixes when working as a dialogs provider, needs a lot more ...
authorDamien Fouilleul <damienf@videolan.org>
Wed, 13 Jun 2007 15:40:54 +0000 (15:40 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Wed, 13 Jun 2007 15:40:54 +0000 (15:40 +0000)
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/qt4.hpp

index 0dadf6d300fd9afd49b89b150dcdec502cf7f901..e4f0447d3668a158fe132220c4e0114be02edcd0 100644 (file)
@@ -261,27 +261,40 @@ MainInputManager::~MainInputManager()
 
 void MainInputManager::updateInput()
 {
-    vlc_mutex_lock( &p_intf->change_lock );
-    if( p_input && p_input->b_dead )
+    if( VLC_OBJECT_INTF == p_intf->i_object_type )
     {
-        vlc_object_release( p_input );
-        getIM()->delInput();
-        p_input = NULL;
-        emit inputChanged( NULL );
-    }
+        vlc_mutex_lock( &p_intf->change_lock );
+        if( p_input && p_input->b_dead )
+        {
+            vlc_object_release( p_input );
+            getIM()->delInput();
+            p_input = NULL;
+            emit inputChanged( NULL );
+        }
 
-    if( !p_input )
-    {
-        QPL_LOCK;
-        p_input = THEPL->p_input;
-        if( p_input )
+        if( !p_input )
+        {
+            QPL_LOCK;
+            p_input = THEPL->p_input;
+            if( p_input )
+            {
+                vlc_object_yield( p_input );
+                emit inputChanged( p_input );
+            }
+            QPL_UNLOCK;
+        }
+        vlc_mutex_unlock( &p_intf->change_lock );
+    }
+    else {
+        /* we are working as a dialogs provider */
+        playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, 
+                                              VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        if( p_playlist )
         {
-            vlc_object_yield( p_input );
+            p_input = p_playlist->p_input;
             emit inputChanged( p_input );
         }
-        QPL_UNLOCK;
     }
-    vlc_mutex_unlock( &p_intf->change_lock );
 }
 
 void MainInputManager::stop()
index 1a84edee2481c72a90bdd53390d34e5f889a1c0f..12f1e2c2777e177358c31eececd4571d6015d74e 100644 (file)
@@ -54,7 +54,7 @@ struct intf_sys_t
 #define QPL_UNLOCK vlc_mutex_unlock( &THEPL->object_lock );
 
 #define THEDP DialogsProvider::getInstance()
-#define THEMIM MainInputManager::getInstance( NULL )
+#define THEMIM MainInputManager::getInstance( p_intf )
 
 #define qfu( i ) QString::fromUtf8( i )
 #define qtr( i ) QString::fromUtf8( _(i) )