[vlc-commits] playlist: remove redundant hack

Rémi Denis-Courmont git at videolan.org
Thu Nov 17 21:08:58 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 17 21:44:23 2016 +0200| [707cbccdd2b255568efca42d23c4a56da5f90bf9] | committer: Rémi Denis-Courmont

playlist: remove redundant hack

Forcing an input item into a playlist item breaks common clean-up
procedures.

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

 src/playlist/loadsave.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 4e4d1e0..67e4029 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -129,8 +129,6 @@ static void input_item_subitem_tree_added( const vlc_event_t * p_event,
 
 int playlist_MLLoad( playlist_t *p_playlist )
 {
-    input_item_t *p_input;
-
     char *psz_datadir = config_GetUserDir( VLC_DATA_DIR );
     if( !psz_datadir ) /* XXX: This should never happen */
     {
@@ -158,20 +156,13 @@ int playlist_MLLoad( playlist_t *p_playlist )
     if( psz_uri == NULL )
         return VLC_ENOMEM;
 
-    p_input = input_item_New( psz_uri, _("Media Library") );
+    input_item_t *p_input = input_item_New( psz_uri, _("Media Library") );
     free( psz_uri );
     if( p_input == NULL )
         return VLC_EGENERIC;
 
-    PL_LOCK;
-    if( p_playlist->p_media_library->p_input )
-        vlc_gc_decref( p_playlist->p_media_library->p_input );
-
-    p_playlist->p_media_library->p_input = p_input;
-
     vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemTreeAdded,
                         input_item_subitem_tree_added, p_playlist );
-    PL_UNLOCK;
 
     vlc_object_t *dummy = vlc_object_create( p_playlist, sizeof (*dummy) );
     var_Create( dummy, "meta-file", VLC_VAR_VOID );
@@ -180,6 +171,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
 
     vlc_event_detach( &p_input->event_manager, vlc_InputItemSubItemTreeAdded,
                         input_item_subitem_tree_added, p_playlist );
+    vlc_gc_decref( p_input );
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list