[vlc-devel] commit: Don't leak the event manager. (Pierre d'Herbemont )

git version control git at videolan.org
Fri Sep 18 12:06:32 CEST 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Mon Sep 14 18:31:10 2009 +0200| [a9dfcaadffbae3214d0e157b6ddbfc9dcdd5c00a] | committer: Pierre d'Herbemont 

Don't leak the event manager.

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

 src/playlist/services_discovery.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index aaa4668..57d8928 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -33,6 +33,8 @@
 #include "../libvlc.h"
 
 
+static void services_discovery_Destructor ( vlc_object_t *p_obj );
+
 /*
  * Services discovery
  * Basically you just listen to Service discovery event through the
@@ -71,6 +73,7 @@ services_discovery_t *vlc_sd_Create( vlc_object_t *p_super )
     vlc_event_manager_register_event_type( &p_sd->event_manager,
             vlc_ServicesDiscoveryEnded );
 
+    vlc_object_set_destructor( p_sd, services_discovery_Destructor );
     vlc_object_attach( p_sd, p_super );
 
     return p_sd;
@@ -114,6 +117,16 @@ void vlc_sd_Stop ( services_discovery_t * p_sd )
 }
 
 /***********************************************************************
+ * Destructor
+ ***********************************************************************/
+static void services_discovery_Destructor ( vlc_object_t *p_obj )
+{
+    services_discovery_t * p_sd = (services_discovery_t *)p_obj;
+    assert(!p_sd->p_module); /* Forgot to call Stop */
+    vlc_event_manager_fini( &p_sd->event_manager );
+}
+
+/***********************************************************************
  * GetLocalizedName
  ***********************************************************************/
 char *




More information about the vlc-devel mailing list