Prevents deadlocks with input in qt4
authorRafaël Carré <funman@videolan.org>
Sat, 18 Aug 2007 17:48:16 +0000 (17:48 +0000)
committerRafaël Carré <funman@videolan.org>
Sat, 18 Aug 2007 17:48:16 +0000 (17:48 +0000)
modules/gui/qt4/components/infopanels.cpp
modules/gui/qt4/dialogs/mediainfo.cpp

index ea98b34..3b87947 100644 (file)
@@ -288,6 +288,7 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent,
  **/
 void ExtraMetaPanel::update( input_item_t *p_item )
 {
+    vlc_mutex_lock( &p_item->lock );
     vlc_meta_t *p_meta = p_item->p_meta;
     if( !p_meta )
         return;
@@ -305,6 +306,7 @@ void ExtraMetaPanel::update( input_item_t *p_item )
         items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) );
         free( ppsz_allkey[i] );
     }
+    vlc_mutex_unlock( &p_item->lock );
     free( ppsz_allkey );
     extraMetaTree->addTopLevelItems( items );
 }
index a5a2729..6935b8f 100644 (file)
@@ -123,9 +123,7 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
 void MediaInfoDialog::setInput( input_item_t *p_input )
 {
     clear();
-    vlc_mutex_lock( &p_input->lock );
     update( p_input, true, true );
-    vlc_mutex_unlock( &p_input->lock );
 }
 
 void MediaInfoDialog::update()
@@ -144,12 +142,10 @@ void MediaInfoDialog::update()
     }
 
     vlc_object_yield( p_input );
-    vlc_mutex_lock( &input_GetItem(p_input)->lock );
 
     update( input_GetItem(p_input), need_update, need_update );
     need_update = false;
 
-    vlc_mutex_unlock( &input_GetItem(p_input)->lock );
     vlc_object_release( p_input );
 }