[vlc-devel] [PATCH 07/18] gui/qt: use vlc_playlist_locker in PLModel::processItemAppend

Filip Roséen filip at videolabs.io
Wed Jul 20 04:36:57 CEST 2016


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

diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 8812bdf..a115e02 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -614,18 +614,18 @@ void PLModel::processItemAppend( int i_pl_itemid, int i_pl_itemidparent )
         if( existing->id( PLAYLIST_ID ) == i_pl_itemid ) return;
 
     /* Find the child */
-    PL_LOCK;
-    p_item = playlist_ItemGetById( p_playlist, i_pl_itemid );
-    if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG )
     {
-        PL_UNLOCK; return;
-    }
+        vlc_playlist_locker pl_lock ( THEPL );
 
-    for( pos = p_item->p_parent->i_children - 1; pos >= 0; pos-- )
-        if( p_item->p_parent->pp_children[pos] == p_item ) break;
+        p_item = playlist_ItemGetById( p_playlist, i_pl_itemid );
+        if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG )
+            return;
 
-    newItem = new PLItem( p_item, nodeParentItem );
-    PL_UNLOCK;
+        for( pos = p_item->p_parent->i_children - 1; pos >= 0; pos-- )
+            if( p_item->p_parent->pp_children[pos] == p_item ) break;
+
+        newItem = new PLItem( p_item, nodeParentItem );
+    }
 
     /* We insert the newItem (children) inside the parent */
     beginInsertRows( index( nodeParentItem, 0 ), pos, pos );
-- 
2.9.0



More information about the vlc-devel mailing list