Commit afccd092 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

objects.c: Automatically detach from the parent.

parent a4e90800
...@@ -389,6 +389,9 @@ static void vlc_object_destroy( vlc_object_t *p_this ) ...@@ -389,6 +389,9 @@ static void vlc_object_destroy( vlc_object_t *p_this )
{ {
vlc_object_internals_t *p_priv = vlc_internals( 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 */ /* Sanity checks */
if( p_this->i_children ) if( p_this->i_children )
{ {
...@@ -412,19 +415,6 @@ static void vlc_object_destroy( vlc_object_t *p_this ) ...@@ -412,19 +415,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
abort(); 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 */ /* Call the custom "subclass" destructor */
if( p_priv->pf_destructor ) if( p_priv->pf_destructor )
p_priv->pf_destructor( p_this ); p_priv->pf_destructor( p_this );
...@@ -1008,9 +998,6 @@ void __vlc_object_detach( vlc_object_t *p_this ) ...@@ -1008,9 +998,6 @@ void __vlc_object_detach( vlc_object_t *p_this )
vlc_mutex_lock( &structure_lock ); vlc_mutex_lock( &structure_lock );
/* Avoid obvious freed object uses */
assert( p_this->p_internals->i_refcount > 0 );
if( !p_this->p_parent ) if( !p_this->p_parent )
{ {
msg_Err( p_this, "object is not attached" ); msg_Err( p_this, "object is not attached" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment