[vlc-commits] commit: skins2: playlist (process delete everywhere in the same way) ( Erwan Tulou )

git at videolan.org git at videolan.org
Tue Aug 10 11:34:08 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Aug  9 23:07:07 2010 +0200| [fb5480e482697ff1895792db0eedd73e97e040c1] | committer: Erwan Tulou 

skins2: playlist (process delete everywhere in the same way)

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb5480e482697ff1895792db0eedd73e97e040c1
---

 modules/gui/skins2/vars/playtree.cpp |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 73008fc..cb8e7b0 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -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 )



More information about the vlc-commits mailing list