[vlc-devel] commit: Hack to get the leaked object tree back ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Mar 5 21:28:10 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Mar  5 22:27:30 2009 +0200| [bde4f0ba22eb98928ed68b236d5cd80efbe0651d] | committer: Rémi Denis-Courmont 

Hack to get the leaked object tree back

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

 src/libvlc.c       |    6 ++++++
 src/misc/objects.c |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index e949996..f90994d 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -1134,6 +1134,12 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
     vlc_mutex_destroy( &priv->config_lock );
     vlc_mutex_destroy( &priv->timer_lock );
 
+#ifndef NDEBUG /* Hack to dump leaked objects tree */
+    if( vlc_internals( p_libvlc )->i_refcount > 1 )
+        while( vlc_internals( p_libvlc )->i_refcount > 0 )
+            vlc_object_release( p_libvlc );
+#endif
+
     assert( vlc_internals( p_libvlc )->i_refcount == 1 );
     vlc_object_release( p_libvlc );
 }
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 3f55190..13f1a84 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -572,8 +572,6 @@ void __vlc_object_release( vlc_object_t *p_this )
 
     if( b_should_destroy )
     {
-        /* We have no children */
-        assert (internals->i_children == 0);
         parent = p_this->p_parent;
 
 #ifndef NDEBUG
@@ -607,6 +605,9 @@ void __vlc_object_release( vlc_object_t *p_this )
         if (parent)
             /* Detach from parent to protect against FIND_CHILDREN */
             vlc_object_detach_unlocked (p_this);
+
+        /* We have no children */
+        assert (internals->i_children == 0);
     }
     libvlc_unlock (p_this->p_libvlc);
 




More information about the vlc-devel mailing list