Commit 7cf5fbe8 authored by Marian Durkovic's avatar Marian Durkovic

Forwardport [18136]: Fixed RecursiveDeleteSelection() to prevent destroying the

whole playlist
parent 979719c9
...@@ -1059,16 +1059,23 @@ void Playlist::RecursiveDeleteSelection( wxTreeItemId root ) ...@@ -1059,16 +1059,23 @@ void Playlist::RecursiveDeleteSelection( wxTreeItemId root )
{ {
wxTreeItemIdValue cookie; wxTreeItemIdValue cookie;
wxTreeItemId child = treectrl->GetFirstChild( root, cookie ); wxTreeItemId child = treectrl->GetFirstChild( root, cookie );
wxTreeItemId nextchild;
bool childIsSelected = FALSE;
bool nextchildIsSelected = FALSE;
if( child.IsOk() ) childIsSelected = treectrl->IsSelected( child );
while( child.IsOk() ) while( child.IsOk() )
{ {
if( treectrl->ItemHasChildren( child ) ) nextchild = treectrl->GetNextChild( root, cookie );
{ if( nextchild.IsOk() )
RecursiveDeleteSelection( child ); nextchildIsSelected = treectrl->IsSelected( nextchild );
if( treectrl->IsSelected(child ) ) DeleteTreeItem( child ); if( childIsSelected )
}
else if( treectrl->IsSelected( child ) )
DeleteTreeItem( child ); DeleteTreeItem( child );
child = treectrl->GetNextChild( root, cookie ); else if( treectrl->ItemHasChildren( child ) )
RecursiveDeleteSelection( child );
child = nextchild;
childIsSelected = nextchildIsSelected;
} }
} }
......
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