[vlc-commits] gui/qt: fix PLModel::createNode when invoked with rootIndex()

Filip Roséen git at videolan.org
Sun Jul 24 20:39:15 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Jul 23 20:44:21 2016 +0200| [52f3159531fc19a4036e628d379536a8bce47e3b] | committer: Francois Cartegnie

gui/qt: fix PLModel::createNode when invoked with rootIndex()

This patch fixes ticket #10051, where it is described that one cannot
create a new directory in the playlist/media-library unless one does it
by right-clicking on an existing item.

In other words; if a request to create a directory is initiated in a
context where the list is empty, it would not work.

The reason is imply because the function prematurely returns if the
passed index does not refer to a specific item, and as such the relevant
check (and premature return) is removed in this commit.

PLModel::createNode already has functionality in place to handle
creating directories as top-level of the relevant playlist, so the
premature return was just blocking this from kicking in.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 modules/gui/qt/components/playlist/playlist_model.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 14720ae..ed21225 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -888,7 +888,8 @@ void PLModel::removeAll()
 
 void PLModel::createNode( QModelIndex index, QString name )
 {
-    if( name.isEmpty() || !index.isValid() ) return;
+    if( name.isEmpty() )
+        return;
 
     vlc_playlist_locker pl_lock ( THEPL );
 



More information about the vlc-commits mailing list