[vlc-commits] gui/qt: fix PLModel::getPLRootType

Filip Roséen git at videolan.org
Sun Jul 24 20:39:15 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Jul 24 16:49:24 2016 +0200| [8a38e84f776d11d30304aa718b28067e55504e54] | committer: Francois Cartegnie

gui/qt: fix PLModel::getPLRootType

This commit fixes the below:

 - Since we are dealing with the playlist, it should be locked for the
   operations inside PLModel::getPLRootType.

 - There is a problem associated with comparing the value of the
   different node's p_input (input_item_t*).

   Given that the input_item_t* can be shared across several nodes, we
   could end up in a state where the prior implementation leads to a
   false-positive.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 modules/gui/qt/components/playlist/playlist_model.cpp |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index ed21225..679c11b 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -553,16 +553,17 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_isinputid ) const
 
 PLModel::pl_nodetype PLModel::getPLRootType() const
 {
+    vlc_playlist_locker pl_lock ( THEPL );
+
     /* can't rely on rootitem as it depends on view / rebuild() */
     AbstractPLItem *plitem = rootItem;
-    while( plitem->parent() ) plitem = plitem->parent();
+    while( plitem->parent() )plitem = plitem->parent();
 
-    const input_item_t *p_item = plitem->inputItem();
-    if( p_item == p_playlist->p_playing->p_input )
+    if( plitem->id( PLAYLIST_ID ) == p_playlist->p_playing->i_id )
         return ROOTTYPE_CURRENT_PLAYING;
 
     if( p_playlist->p_media_library &&
-        p_item == p_playlist->p_media_library->p_input )
+        plitem->id( PLAYLIST_ID ) == p_playlist->p_media_library->i_id )
         return ROOTTYPE_MEDIA_LIBRARY;
 
     return ROOTTYPE_OTHER;



More information about the vlc-commits mailing list