Commit 2ed6e6a6 authored by Erwan Tulou's avatar 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)
parent 0972b082
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include "../utils/ustring.hpp" #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 // Get the VLC playlist object
m_pPlaylist = pIntf->p_sys->p_playlist; m_pPlaylist = pIntf->p_sys->p_playlist;
m_playingIt = end();
i_items_to_append = 0; i_items_to_append = 0;
...@@ -148,11 +148,12 @@ void Playtree::onUpdateCurrent( bool b_active ) ...@@ -148,11 +148,12 @@ void Playtree::onUpdateCurrent( bool b_active )
{ {
if( !b_active ) if( !b_active )
{ {
if( m_playingIt == end() ) if( !m_currentItem )
return; return;
m_playingIt->m_playing = false; Iterator it = findById( m_currentItem->i_id );
m_playingIt = end(); it->m_playing = false;
m_currentItem = NULL;
} }
else else
{ {
...@@ -167,7 +168,7 @@ void Playtree::onUpdateCurrent( bool b_active ) ...@@ -167,7 +168,7 @@ void Playtree::onUpdateCurrent( bool b_active )
Iterator it = findById( current->i_id ); Iterator it = findById( current->i_id );
it->m_playing = true; it->m_playing = true;
m_playingIt = it; m_currentItem = current;
playlist_Unlock( m_pPlaylist ); playlist_Unlock( m_pPlaylist );
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifndef PLAYTREE_HPP #ifndef PLAYTREE_HPP
#define PLAYTREE_HPP #define PLAYTREE_HPP
#include <vlc_playlist.h>
#include "../utils/var_tree.hpp" #include "../utils/var_tree.hpp"
/// Variable for VLC playlist (new tree format) /// Variable for VLC playlist (new tree format)
...@@ -69,7 +70,7 @@ private: ...@@ -69,7 +70,7 @@ private:
void buildNode( playlist_item_t *p_node, VarTree &m_pNode ); void buildNode( playlist_item_t *p_node, VarTree &m_pNode );
/// keep track of item being played /// keep track of item being played
Iterator m_playingIt; playlist_item_t* m_currentItem;
}; };
#endif #endif
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