[vlc-devel] [PATCH 08/18] gui/qt: use vlc_playlist_locker in PLModel::rebuild

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


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

diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index a115e02..29f3f62 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -642,17 +642,19 @@ void PLModel::rebuild( playlist_item_t *p_root )
 {
     beginResetModel();
 
-    PL_LOCK;
-    if( rootItem ) rootItem->clearChildren();
-    if( p_root ) // Can be NULL
     {
-        if ( rootItem ) delete rootItem;
-        rootItem = new PLItem( p_root );
+        vlc_playlist_locker pl_lock ( THEPL );
+
+        if( rootItem ) rootItem->clearChildren();
+        if( p_root ) // Can be NULL
+        {
+            if ( rootItem ) delete rootItem;
+            rootItem = new PLItem( p_root );
+        }
+        assert( rootItem );
+        /* Recreate from root */
+        updateChildren( rootItem );
     }
-    assert( rootItem );
-    /* Recreate from root */
-    updateChildren( rootItem );
-    PL_UNLOCK;
 
     /* And signal the view */
     endResetModel();
-- 
2.9.0



More information about the vlc-devel mailing list