]> git.sesse.net Git - vlc/commitdiff
objects.c: Automatically detach from the parent.
authorPierre d'Herbemont <pdherbemont@free.fr>
Wed, 19 Mar 2008 00:29:12 +0000 (01:29 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Wed, 19 Mar 2008 00:29:12 +0000 (01:29 +0100)
src/misc/objects.c

index 28f8d8fae569eba66b884eda1f3fdda79e2392fe..fa1bfe0281de61636a56c45be9231fa165c2b218 100644 (file)
@@ -389,6 +389,9 @@ static void vlc_object_destroy( vlc_object_t *p_this )
 {
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
 
+    /* Automatically detach the object from its parents */
+    if( p_this->p_parent ) vlc_object_detach( p_this );
+
     /* Sanity checks */
     if( p_this->i_children )
     {
@@ -412,19 +415,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
         abort();
     }
 
-    if( p_this->p_parent )
-    {
-        fprintf( stderr,
-                 "ERROR: cannot delete object (id:%i, type:%s, name:%s) "
-                 "with a parent (id:%i, type:%s, name:%s)\n",
-                 p_this->i_object_id, p_this->psz_object_type,
-                 p_this->psz_object_name, p_this->p_parent->i_object_id,
-                 p_this->p_parent->psz_object_type,
-                 p_this->p_parent->psz_object_name );
-        fflush(stderr);
-        abort();
-    }
-
     /* Call the custom "subclass" destructor */
     if( p_priv->pf_destructor )
         p_priv->pf_destructor( p_this );
@@ -1008,9 +998,6 @@ void __vlc_object_detach( vlc_object_t *p_this )
 
     vlc_mutex_lock( &structure_lock );
 
-    /* Avoid obvious freed object uses */
-    assert( p_this->p_internals->i_refcount > 0 );
-
     if( !p_this->p_parent )
     {
         msg_Err( p_this, "object is not attached" );