[vlc-devel] commit: skins2: correct playlist issue when sorting is used (Erwan Tulou )

git version control git at videolan.org
Wed Feb 17 17:19:09 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Feb 17 17:03:39 2010 +0100| [2ed6e6a63f838e732ed1e2f5ad030b83a7489a12] | committer: Erwan Tulou 

skins2: correct playlist issue when sorting is used

better keep track of the playlist_item_t reference than its iterator
 (may change if the playlist is sorted)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ed6e6a63f838e732ed1e2f5ad030b83a7489a12
---

 modules/gui/skins2/vars/playtree.cpp |   13 +++++++------
 modules/gui/skins2/vars/playtree.hpp |    3 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 8e0584c..4cbd1be 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -32,11 +32,11 @@
 #include <vlc_playlist.h>
 #include "../utils/ustring.hpp"
 
-Playtree::Playtree( intf_thread_t *pIntf ): VarTree( pIntf )
+Playtree::Playtree( intf_thread_t *pIntf ):
+    VarTree( pIntf ), m_currentItem( NULL )
 {
     // Get the VLC playlist object
     m_pPlaylist = pIntf->p_sys->p_playlist;
-    m_playingIt = end();
 
     i_items_to_append = 0;
 
@@ -148,11 +148,12 @@ void Playtree::onUpdateCurrent( bool b_active )
 {
     if( !b_active )
     {
-        if( m_playingIt == end() )
+        if( !m_currentItem )
             return;
 
-        m_playingIt->m_playing = false;
-        m_playingIt = end();
+        Iterator it = findById( m_currentItem->i_id );
+        it->m_playing = false;
+        m_currentItem = NULL;
     }
     else
     {
@@ -167,7 +168,7 @@ void Playtree::onUpdateCurrent( bool b_active )
 
         Iterator it = findById( current->i_id );
         it->m_playing = true;
-        m_playingIt = it;
+        m_currentItem = current;
 
         playlist_Unlock( m_pPlaylist );
     }
diff --git a/modules/gui/skins2/vars/playtree.hpp b/modules/gui/skins2/vars/playtree.hpp
index 147cbe4..871cc08 100644
--- a/modules/gui/skins2/vars/playtree.hpp
+++ b/modules/gui/skins2/vars/playtree.hpp
@@ -25,6 +25,7 @@
 #ifndef PLAYTREE_HPP
 #define PLAYTREE_HPP
 
+#include <vlc_playlist.h>
 #include "../utils/var_tree.hpp"
 
 /// Variable for VLC playlist (new tree format)
@@ -69,7 +70,7 @@ private:
     void buildNode( playlist_item_t *p_node, VarTree &m_pNode );
 
     /// keep track of item being played
-    Iterator m_playingIt;
+    playlist_item_t* m_currentItem;
 };
 
 #endif




More information about the vlc-devel mailing list