[vlc-devel] commit: Fix media library's input items reference counting ( Rafaël Carré )

git version control git at videolan.org
Tue Apr 1 21:12:41 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Apr  1 21:12:34 2008 +0200| [09ce2046a19146b3992159ddb716d8bab45bc285]

Fix media library's input items reference counting

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

 src/playlist/engine.c   |   11 +++++++++++
 src/playlist/loadsave.c |    2 --
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 5dc8257..0529d75 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -396,6 +396,15 @@ check_input:
     PL_UNLOCK;
 }
 
+static void ML_Decref( playlist_item_t *p_node )
+{
+    vlc_gc_decref( p_node->p_input );
+
+    int i;
+    if( p_node->i_children > 0 )
+        for( i = 0 ; i < p_node->i_children ; i++ )
+            ML_Decref( p_node->pp_children[i] );
+}
 
 /**
  * Last loop
@@ -476,6 +485,8 @@ void playlist_LastLoop( playlist_t *p_playlist )
     }
 
     playlist_MLDump( p_playlist );
+    /* We don't need the media library anymore */
+    ML_Decref( p_playlist->p_ml_category );
 
     PL_LOCK;
     FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index f3b97cd..830a0d1 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -180,8 +180,6 @@ int playlist_MLLoad( playlist_t *p_playlist )
     vlc_event_detach( &p_input->event_manager, vlc_InputItemSubItemAdded,
                         input_item_subitem_added, p_playlist );
 
-    vlc_gc_decref( p_input );
-
     free( psz_uri );
     return VLC_SUCCESS;
 




More information about the vlc-devel mailing list