]> git.sesse.net Git - vlc/commitdiff
playlist_NodeRemoveItem(): set item's parent to NULL
authorJakob Leben <jleben@videolan.org>
Sun, 20 Jun 2010 12:47:40 +0000 (14:47 +0200)
committerJakob Leben <jleben@videolan.org>
Sun, 20 Jun 2010 13:23:29 +0000 (15:23 +0200)
src/playlist/tree.c

index 46144a88292ebdc167fc86421db76fe2509e7a66..ebaa68a8e11cb248f5276c220dda6df6f4d8ad2c 100644 (file)
@@ -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;
 }
 
 /**