[vlc-commits] commit: skins2: playlist make sure deletion works for both nodes and leaves (Erwan Tulou )

git at videolan.org git at videolan.org
Tue Aug 10 18:57:08 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Aug 10 18:19:15 2010 +0200| [e866693d12668857fe05564e64c7b73b1240e38b] | committer: Erwan Tulou 

skins2: playlist make sure deletion works for both nodes and leaves

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

 modules/gui/skins2/vars/playtree.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 43cba38..c8dfb91 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -51,12 +51,11 @@ void Playtree::delSelected()
 {
     Iterator it = begin();
     playlist_Lock( getIntf()->p_sys->p_playlist );
-    for( it = begin(); it != end(); it = getNextVisibleItem( it ) )
+    for( it = begin(); it != end(); it = getNextItem( it ) )
     {
-        if( (*it).m_selected && !(*it).isReadonly() )
+        if( it->m_selected && !it->isReadonly() )
         {
-            (*it).m_deleted = true;
-            (*it).m_expanded = false;
+            it->cascadeDelete();
         }
     }
     /// \todo Do this better (handle item-deleted)
@@ -66,7 +65,7 @@ void Playtree::delSelected()
     it = begin();
     while( it != end() )
     {
-        if( (*it).m_deleted )
+        if( it->m_deleted )
         {
             VarTree::Iterator it2;
             playlist_item_t *p_item = (playlist_item_t *)(it->m_pData);
@@ -74,13 +73,14 @@ void Playtree::delSelected()
             {
                 playlist_DeleteFromInput( getIntf()->p_sys->p_playlist,
                                           p_item->p_input, pl_Locked );
+                it2 = getNextItem( it ) ;
             }
             else
             {
                 playlist_NodeDelete( getIntf()->p_sys->p_playlist, p_item,
                                      true, false );
+                it2 = it->getNextSiblingOrUncle();
             }
-            it2 = getNextItem( it ) ;
             it->parent()->removeChild( it );
             it = it2;
         }



More information about the vlc-commits mailing list