]> git.sesse.net Git - vlc/commitdiff
Hack to get the leaked object tree back
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 5 Mar 2009 20:27:30 +0000 (22:27 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 5 Mar 2009 20:28:02 +0000 (22:28 +0200)
src/libvlc.c
src/misc/objects.c

index e9499963bed2a03977e0d40325f8107f6d04037a..f90994d435b3372c63eceff3fb83fb83053b94aa 100644 (file)
@@ -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 );
 }
index 3f551900d97d9eb0a88d9c31e61e3d3f0cda9cc1..13f1a849056f6efb56319936444ec5cf17f48b5f 100644 (file)
@@ -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);