]> git.sesse.net Git - vlc/commitdiff
Qt4: don't "leak" playlist items
authorJakob Leben <jleben@videolan.org>
Sun, 1 Nov 2009 19:14:25 +0000 (20:14 +0100)
committerJakob Leben <jleben@videolan.org>
Mon, 2 Nov 2009 03:54:05 +0000 (04:54 +0100)
There was opportunity for playlist items not showing up in Qt playlist due to race between playlist rebuilding and item-added, item-removed callbacks
Maybe also fixes some aspects of #2297 or completely - to test.

modules/gui/qt4/components/playlist/playlist_model.cpp

index 9b1d7f090526fbee5af6fa149aab2614ab65626e..b991e46c2c5a786a18f939eed5dfb7af40f943cc 100644 (file)
@@ -89,6 +89,7 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     ADD_ICON( NODE, ":/type/node" );
 #undef ADD_ICON
 
+    addCallbacks();
     rebuild( p_root, true );
     CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
             this, processInputItemUpdate( input_item_t *) );
@@ -700,11 +701,6 @@ void PLModel::rebuild()
 void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
 {
     playlist_item_t* p_item;
-    /* Remove callbacks before locking to avoid deadlocks
-       The first time the callbacks are not present so
-       don't try to delete them */
-    if( !b_first )
-        delCallbacks();
 
     /* Invalidate cache */
     i_cached_id = i_cached_input_id = -1;
@@ -730,8 +726,6 @@ void PLModel::rebuild( playlist_item_t *p_root, bool b_first )
     reset();
 
     emit currentChanged( index( currentItem, 0 ) );
-
-    addCallbacks();
 }
 
 void PLModel::takeItem( PLItem *item )