Commit 1ef175cb authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix skins crashing when playlist is flat

m_firstPos (iterator associated to a stl list container) is not guaranteed to be valid (the associated item may have been deleted). Up to vlc1.0, this was no problem, because deleting an item was also buggy (a no-op). From vlc1.1 on, m_firstPos must now be recomputed to ensure it keeps on pointing to a valid item in all cases.

start for instance a playlist with the 'Dragon' skin as a test case.
This was pointed out by colt45 (from the forum)
parent 86ca1b56
...@@ -138,6 +138,8 @@ int CtrlTree::maxItems() ...@@ -138,6 +138,8 @@ int CtrlTree::maxItems()
void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree, void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree,
tree_update *arg ) tree_update *arg )
{ {
m_firstPos = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
if( arg->i_type == 0 ) // Item update if( arg->i_type == 0 ) // Item update
{ {
if( arg->b_active_item ) if( arg->b_active_item )
...@@ -150,7 +152,6 @@ void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree, ...@@ -150,7 +152,6 @@ void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree,
/// \todo handle delete in a more clever way /// \todo handle delete in a more clever way
else if ( arg->i_type == 1 ) // Global change or deletion else if ( arg->i_type == 1 ) // Global change or deletion
{ {
m_firstPos = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
makeImage(); makeImage();
} }
else if ( arg->i_type == 2 ) // Item-append else if ( arg->i_type == 2 ) // Item-append
......
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