[vlc-commits] playlist: delete items a.s.a.p.

Rémi Denis-Courmont git at videolan.org
Tue Nov 15 22:19:39 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 15 22:54:37 2016 +0200| [ff130ffa31680504a0af6b67508737da82604350] | committer: Rémi Denis-Courmont

playlist: delete items a.s.a.p.

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

 src/playlist/engine.c            |  7 -------
 src/playlist/item.c              | 11 +++--------
 src/playlist/playlist_internal.h |  3 ---
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 4275c3a..f26bf44 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -222,7 +222,6 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
 
     ARRAY_INIT( p_playlist->items );
     ARRAY_INIT( p_playlist->all_items );
-    ARRAY_INIT( pl_priv(p_playlist)->items_to_delete );
     ARRAY_INIT( p_playlist->current );
 
     p_playlist->i_current_index = 0;
@@ -338,12 +337,6 @@ void playlist_Destroy( playlist_t *p_playlist )
         free( p_del );
     FOREACH_END();
     ARRAY_RESET( p_playlist->all_items );
-    FOREACH_ARRAY( playlist_item_t *p_del, p_sys->items_to_delete )
-        free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
-        free( p_del );
-    FOREACH_END();
-    ARRAY_RESET( p_sys->items_to_delete );
 
     ARRAY_RESET( p_playlist->items );
     ARRAY_RESET( p_playlist->current );
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 97f2e37..3127cf3 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -308,15 +308,10 @@ int playlist_ItemRelease( playlist_item_t *p_item )
     playlist_t *p_playlist = p_item->p_playlist;
     PL_ASSERT_LOCKED;
 
-    /* Surprise, we can't actually do more because we
-     * don't do refcounting, or eauivalent.
-     * Because item are not only accessed by their id
-     * using playlist_item outside the PL_LOCK isn't safe.
-     * Most of the modules does that.
-     *
-     * Who wants to add proper memory management? */
     uninstall_input_item_observer( p_item );
-    ARRAY_APPEND( pl_priv(p_playlist)->items_to_delete, p_item);
+    free( p_item->pp_children );
+    vlc_gc_decref( p_item->p_input );
+    free( p_item );
     return VLC_SUCCESS;
 }
 
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 988e0af..63e1a91 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -49,9 +49,6 @@ typedef struct playlist_private_t
     playlist_t           public_data;
     struct intf_thread_t *interface; /**< Linked-list of interfaces */
 
-    playlist_item_array_t items_to_delete; /**< Array of items and nodes to
-            delete... At the very end. This sucks. */
-
     vlc_sd_internal_t   **pp_sds;
     int                   i_sds;   /**< Number of service discovery modules */
     input_thread_t *      p_input;  /**< the input thread associated



More information about the vlc-commits mailing list