From 81652244c4049260892d4def1011c82cd3e303cb Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Mon, 9 Aug 2010 22:41:30 +0200 Subject: [PATCH] skins2: playlist a few iterator issues - check validity before using iterators - don't use iterator anymore once the item is erased --- modules/gui/skins2/vars/playtree.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp index 05cb89fb7a..73008fc1be 100644 --- a/modules/gui/skins2/vars/playtree.cpp +++ b/modules/gui/skins2/vars/playtree.cpp @@ -149,7 +149,8 @@ void Playtree::onUpdateCurrent( bool b_active ) return; Iterator it = findById( m_currentItem->i_id ); - it->m_playing = false; + if( it != end() ) + it->m_playing = false; m_currentItem = NULL; } else @@ -164,7 +165,8 @@ void Playtree::onUpdateCurrent( bool b_active ) } Iterator it = findById( current->i_id ); - it->m_playing = true; + if( it != end() ) + it->m_playing = true; m_currentItem = current; playlist_Unlock( m_pPlaylist ); @@ -187,9 +189,11 @@ void Playtree::onDelete( int i_id ) Iterator item = findById( i_id ) ; if( item != end() ) { - if( item->parent() ) - item->parent()->removeChild( item ); - descr.b_visible = item->parent() ? item->parent()->m_expanded : true; + VarTree* parent = item->parent(); + if( parent ) + parent->removeChild( item ); + + descr.b_visible = parent ? parent->m_expanded : true; notify( &descr ); } } -- 2.11.4.GIT