]> git.sesse.net Git - vlc/commitdiff
playlist/services_discovery.c: Attempt at removing also node as well as regular items...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 11 Oct 2007 00:11:26 +0000 (00:11 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 11 Oct 2007 00:11:26 +0000 (00:11 +0000)
src/playlist/services_discovery.c

index ce119887c95d678bd65706a807753f2729552d8d..0dad2af4c88e4d530831651a95d5dbee38426a8a 100644 (file)
@@ -224,7 +224,23 @@ static void playlist_sd_item_removed( const vlc_event_t * p_event, void * user_d
 {
     input_item_t * p_input = p_event->u.services_discovery_item_removed.p_item;
     playlist_item_t * p_parent = user_data;
+    playlist_item_t * p_pl_item;
+    
+    /* First make sure that if item is a node it will be deleted.
+     * XXX: Why don't we have a function to ensure that in the playlist code ? */
+    vlc_object_lock( p_parent->p_playlist );
+    p_pl_item = playlist_ItemFindFromInputAndRoot( p_parent->p_playlist,
+            p_input->i_id, p_parent, VLC_TRUE );
+
+    if( p_pl_item->i_children > -1 )
+    {
+        playlist_NodeDelete( p_parent->p_playlist, p_pl_item, VLC_TRUE, VLC_FALSE );
+        vlc_object_unlock( p_parent->p_playlist );
+        return;
+    }
+    vlc_object_unlock( p_parent->p_playlist );
 
+    /* Delete the non-node item normally */
     playlist_DeleteInputInParent( p_parent->p_playlist, p_input->i_id,
                                   p_parent, VLC_FALSE );
 }