[vlc-devel] [PATCH] Fix playlist: wrong new index when moving items

Jakob Leben jakob.leben at gmail.com
Thu Jul 30 19:44:12 CEST 2009


TreeMove() does not handle correctly the case when moving items into a node
from outside. This patch fixes it by adding a simple check whether the item
being moved already belongs to the node inside which it's requested new
position resides.
---
 src/playlist/item.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/playlist/item.c b/src/playlist/item.c
index b95fc42..8b064f2 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -691,7 +691,7 @@ static int TreeMove( playlist_t *p_playlist,
playlist_item_t *p_item,
      * down of the playlist. So when removing the element we have
      * to change the position as we loose one element
      */
-    if( j < i_newpos )
+    if( p_item->p_parent == p_node && j < i_newpos )
         i_newpos--;

     /* Attach to new parent */
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090730/3334d7b4/attachment.html>


More information about the vlc-devel mailing list