[vlc-commits] commit: skins2: fix skins crashing when playlist is flat (Erwan Tulou )

git at videolan.org git at videolan.org
Sun May 9 23:37:36 CEST 2010


vlc/vlc-1.1 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu May  6 20:09:25 2010 +0200| [0484db2cb1906908d510d1dca49da0de46e88309] | committer: Jean-Baptiste Kempf 

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)
(cherry picked from commit 1ef175cb28927f1ad01acabaf6e09936c451dc60)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=0484db2cb1906908d510d1dca49da0de46e88309
---

 modules/gui/skins2/controls/ctrl_tree.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 3048254..27ffdd2 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -138,6 +138,8 @@ int CtrlTree::maxItems()
 void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree,
                          tree_update *arg )
 {
+    m_firstPos = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
+
     if( arg->i_type == 0 ) // Item update
     {
         if( arg->b_active_item )
@@ -150,7 +152,6 @@ void CtrlTree::onUpdate( Subject<VarTree, tree_update> &rTree,
     /// \todo handle delete in a more clever way
     else if ( arg->i_type == 1 ) // Global change or deletion
     {
-        m_firstPos = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
         makeImage();
     }
     else if ( arg->i_type == 2 ) // Item-append



More information about the vlc-commits mailing list