[vlc-devel] commit: Qt4: correct the check whether item is node (Jakob Leben )

git version control git at videolan.org
Tue Aug 18 09:41:40 CEST 2009


vlc | branch: master | Jakob Leben <jakob.leben at gmail.com> | Tue Aug 18 01:01:40 2009 +0200| [c06416a2e52db9f2701738fcf0eb15c8717e284c] | committer: Ilkka Ollakka 

Qt4: correct the check whether item is node

( 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 at videolan.org>

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

 .../gui/qt4/components/playlist/playlist_model.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 3553103..08c6b56 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -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;
     }
 




More information about the vlc-devel mailing list