[vlc-commits] gui/qt: use vlc_playlist_locker in PLModel::processItemAppend

Filip Roséen git at videolan.org
Wed Jul 20 16:15:55 CEST 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Wed Jul 20 04:36:57 2016 +0200| [5acdd9c3d4738c3ce4da344793a572e7f50029c8] | committer: Jean-Baptiste Kempf

gui/qt: use vlc_playlist_locker in PLModel::processItemAppend

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 .../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 );



More information about the vlc-commits mailing list