]> git.sesse.net Git - vlc/commitdiff
skins2: playlist (process delete everywhere in the same way)
authorErwan Tulou <erwan10@videolan.org>
Mon, 9 Aug 2010 21:07:07 +0000 (23:07 +0200)
committerErwan Tulou <erwan10@videolan.org>
Tue, 10 Aug 2010 09:30:50 +0000 (11:30 +0200)
Deleting an item can either be initiated by the user or coming from the core.
In one case, a m_deleted flag was added and notify occured before
deletion to avoid invalidated iterators.
This patch ensures that the other case is processed likewise.

modules/gui/skins2/vars/playtree.cpp

index 73008fc1be1f5d5e37c748a4c94a74a9f81ef0c2..cb8e7b0ecb5ef32c4a4cc92e11aec8eebbc6ca94 100644 (file)
@@ -183,19 +183,23 @@ void Playtree::onUpdateCurrent( bool b_active )
 //  already removed it
 void Playtree::onDelete( int i_id )
 {
-    tree_update descr;
-    descr.i_id = i_id;
-    descr.i_type = 3;
     Iterator item = findById( i_id ) ;
     if( item != end() )
     {
         VarTree* parent = item->parent();
-        if( parent )
-            parent->removeChild( item );
 
+        item->m_deleted = true;
+
+        tree_update descr;
+        descr.i_id = i_id;
+        descr.i_type = 3;
         descr.b_visible = parent ? parent->m_expanded : true;
         notify( &descr );
+
+        if( parent )
+            parent->removeChild( item );
     }
+
 }
 
 void Playtree::onAppend( playlist_add_t *p_add )