Commit 7659cde9 authored by Erwan Tulou's avatar Erwan Tulou

skins2: playlist a few iterator issues

- check validity before using iterators
- don't use iterator anymore once the item is erased
(cherry picked from commit 81652244c4049260892d4def1011c82cd3e303cb)
parent 84b42f81
...@@ -152,7 +152,8 @@ void Playtree::onUpdateCurrent( bool b_active ) ...@@ -152,7 +152,8 @@ void Playtree::onUpdateCurrent( bool b_active )
return; return;
Iterator it = findById( m_currentItem->i_id ); Iterator it = findById( m_currentItem->i_id );
it->m_playing = false; if( it != end() )
it->m_playing = false;
m_currentItem = NULL; m_currentItem = NULL;
} }
else else
...@@ -167,7 +168,8 @@ void Playtree::onUpdateCurrent( bool b_active ) ...@@ -167,7 +168,8 @@ void Playtree::onUpdateCurrent( bool b_active )
} }
Iterator it = findById( current->i_id ); Iterator it = findById( current->i_id );
it->m_playing = true; if( it != end() )
it->m_playing = true;
m_currentItem = current; m_currentItem = current;
playlist_Unlock( m_pPlaylist ); playlist_Unlock( m_pPlaylist );
...@@ -190,9 +192,11 @@ void Playtree::onDelete( int i_id ) ...@@ -190,9 +192,11 @@ void Playtree::onDelete( int i_id )
Iterator item = findById( i_id ) ; Iterator item = findById( i_id ) ;
if( item != end() ) if( item != end() )
{ {
if( item->parent() ) VarTree* parent = item->parent();
item->parent()->removeChild( item ); if( parent )
descr.b_visible = item->parent() ? item->parent()->m_expanded : true; parent->removeChild( item );
descr.b_visible = parent ? parent->m_expanded : true;
notify( &descr ); notify( &descr );
} }
} }
......
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