[vlc-commits] commit: playlist_NodeRemoveItem(): set item's parent to NULL (Jakob Leben )

git at videolan.org git at videolan.org
Sun Jun 20 15:44:37 CEST 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Sun Jun 20 14:47:40 2010 +0200| [afbc7600a302fe2617fe409b06e0939f31b2bcb2] | committer: Jakob Leben 

playlist_NodeRemoveItem(): set item's parent to NULL

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

 src/playlist/tree.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 46144a8..ebaa68a 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -248,15 +248,23 @@ int playlist_NodeRemoveItem( playlist_t *p_playlist,
     PL_ASSERT_LOCKED;
    (void)p_playlist;
 
+   int ret = VLC_EGENERIC;
+
    for(int i= 0; i< p_parent->i_children ; i++ )
    {
        if( p_parent->pp_children[i] == p_item )
        {
            REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i );
+           ret = VLC_SUCCESS;
        }
    }
 
-   return VLC_SUCCESS;
+    if( ret == VLC_SUCCESS ) {
+        assert( p_item->p_parent == p_parent );
+        p_item->p_parent = NULL;
+    }
+
+    return ret;
 }
 
 /**



More information about the vlc-commits mailing list