Commit e866693d authored by Erwan Tulou's avatar Erwan Tulou

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

parent cf79a31c
...@@ -51,12 +51,11 @@ void Playtree::delSelected() ...@@ -51,12 +51,11 @@ void Playtree::delSelected()
{ {
Iterator it = begin(); Iterator it = begin();
playlist_Lock( getIntf()->p_sys->p_playlist ); 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->cascadeDelete();
(*it).m_expanded = false;
} }
} }
/// \todo Do this better (handle item-deleted) /// \todo Do this better (handle item-deleted)
...@@ -66,7 +65,7 @@ void Playtree::delSelected() ...@@ -66,7 +65,7 @@ void Playtree::delSelected()
it = begin(); it = begin();
while( it != end() ) while( it != end() )
{ {
if( (*it).m_deleted ) if( it->m_deleted )
{ {
VarTree::Iterator it2; VarTree::Iterator it2;
playlist_item_t *p_item = (playlist_item_t *)(it->m_pData); playlist_item_t *p_item = (playlist_item_t *)(it->m_pData);
...@@ -74,13 +73,14 @@ void Playtree::delSelected() ...@@ -74,13 +73,14 @@ void Playtree::delSelected()
{ {
playlist_DeleteFromInput( getIntf()->p_sys->p_playlist, playlist_DeleteFromInput( getIntf()->p_sys->p_playlist,
p_item->p_input, pl_Locked ); p_item->p_input, pl_Locked );
it2 = getNextItem( it ) ;
} }
else else
{ {
playlist_NodeDelete( getIntf()->p_sys->p_playlist, p_item, playlist_NodeDelete( getIntf()->p_sys->p_playlist, p_item,
true, false ); true, false );
it2 = it->getNextSiblingOrUncle();
} }
it2 = getNextItem( it ) ;
it->parent()->removeChild( it ); it->parent()->removeChild( it );
it = it2; it = it2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment