[vlc-devel] commit: Revert "Remove playlist destructor" ( Rafaël Carré )

git version control git at videolan.org
Wed May 14 22:27:50 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed May 14 21:49:15 2008 +0200| [0e3e5da42643cac283fc0e758147351635679abf]

Revert "Remove playlist destructor"

This reverts commit 3d7eabaf80eb76dc2111f399aec6586d1b0094a8.

Signed-off-by: Pierre d'Herbemont <pdherbemont at videolan.org>

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

 src/playlist/engine.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 3eae589..b601439 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -38,6 +38,7 @@
  * Local prototypes
  *****************************************************************************/
 static void VariablesInit( playlist_t *p_playlist );
+static void playlist_Destructor( vlc_object_t * p_this );
 
 static int RandomCallback( vlc_object_t *p_this, char const *psz_cmd,
                            vlc_value_t oldval, vlc_value_t newval, void *a )
@@ -153,6 +154,8 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     playlist_MLLoad( p_playlist );
     p_playlist->b_auto_preparse = true;
 
+    vlc_object_set_destructor( p_playlist, playlist_Destructor );
+
     return p_playlist;
 }
 
@@ -165,6 +168,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
  */
 void playlist_Destroy( playlist_t *p_playlist )
 {
+    /* XXX: should go in the playlist destructor */
     var_Destroy( p_playlist, "intf-change" );
     var_Destroy( p_playlist, "item-change" );
     var_Destroy( p_playlist, "playlist-current" );
@@ -177,12 +181,24 @@ void playlist_Destroy( playlist_t *p_playlist )
     var_Destroy( p_playlist, "loop" );
     var_Destroy( p_playlist, "activity" );
 
+    vlc_object_release( p_playlist );
+}
+
+static void playlist_Destructor( vlc_object_t * p_this )
+{
+    playlist_t * p_playlist = (playlist_t *)p_this;
+
+    // Kill preparser
     if( p_playlist->p_preparse )
+    {
         vlc_object_release( p_playlist->p_preparse );
+    }
+
+    // Kill meta fetcher
     if( p_playlist->p_fetcher )
+    {
         vlc_object_release( p_playlist->p_fetcher );
-
-    vlc_object_release( p_playlist );
+    }
 }
 
 /* Destroy remaining objects */




More information about the vlc-devel mailing list