]> git.sesse.net Git - vlc/commitdiff
Qt4: correct the check whether item is node
authorJakob Leben <jakob.leben@gmail.com>
Mon, 17 Aug 2009 23:01:40 +0000 (01:01 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Tue, 18 Aug 2009 07:40:59 +0000 (10:40 +0300)
( PLModel::childrenCount() > 0 ) is not equivalent to (
playlist_item_t*->i_children > -1 ). This patch swaps former for latter
which is a correct strict check wether an item is node.

Signed-off-by: Ilkka Ollakka <ileoo@videolan.org>
modules/gui/qt4/components/playlist/playlist_model.cpp

index 355310344b3d1888adcde08a3e69f446fbcd2de0..08c6b563fba46ddebcd59e53350917357d5a73e4 100644 (file)
@@ -158,10 +158,14 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
     }
     else
     {
-        if ( (item->childCount() > 0) &&
+        PL_LOCK;
+        playlist_item_t *plItem =
+            playlist_ItemGetById( p_playlist, item->i_id );
+        if ( plItem && ( plItem->i_children > -1 ) &&
             ( rootItem->p_input == pl_input ||
             rootItem->p_input == ml_input ) )
                 flags |= Qt::ItemIsDropEnabled;
+        PL_UNLOCK;
         flags |= Qt::ItemIsDragEnabled;
     }