[vlc-devel] commit: Also remove the link fromn dead objects toward their children ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 17 18:23:54 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sat May 17 19:22:54 2008 +0300| [1f5fe769ca2386234ad22cd60174fc700344302f]

Also remove the link fromn dead objects toward their children

Previously, we only removed links from children to dead parents.
This patch is semantically the same as Funman's earlier
vlc_object_detach_unlocked() patch. It is merely faster and less clean.

Unfortunately, this means it is impossible to detect leaked children.
That being noted, leaving dead parents "semi-attached" in objects tree
is not thread-safe anyhow. Basically, we either automatically detach
objects (and miss leaks), or require children to be detached/destroyed
before their parent is destroyed (and get leaks detection, but more
coding pain).

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

 src/misc/objects.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index f248997..bb4a512 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -889,7 +889,12 @@ void __vlc_object_release( vlc_object_t *p_this )
     vlc_mutex_unlock( &structure_lock );
 
     if( b_should_destroy )
+    {
+        free( internals->pp_children );
+        internals->pp_children = NULL;
+        internals->i_children = 0;
         vlc_object_destroy( p_this );
+    }
 }
 
 /**




More information about the vlc-devel mailing list