]> git.sesse.net Git - vlc/commitdiff
skins2: correct playlist issue when sorting is used
authorErwan Tulou <erwan10@videolan.org>
Wed, 17 Feb 2010 16:03:39 +0000 (17:03 +0100)
committerErwan Tulou <erwan10@videolan.org>
Wed, 17 Feb 2010 16:12:30 +0000 (17:12 +0100)
better keep track of the playlist_item_t reference than its iterator
 (may change if the playlist is sorted)

modules/gui/skins2/vars/playtree.cpp
modules/gui/skins2/vars/playtree.hpp

index 8e0584c2f7375be8abfde4aa7877a554fa523cb5..4cbd1be413b6bd75bcc352cb0b7bd4a07b635e6b 100644 (file)
 #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 );
     }
index 147cbe474075ba455fa4fea04289115168dcf4b4..871cc08e9bc37c2a2e3bed0b87b2016a81089002 100644 (file)
@@ -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