[vlc-devel] commit: objects.c: Automatically detach from the parent. (Pierre d' Herbemont )

git version control git at videolan.org
Wed Mar 19 01:30:05 CET 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed Mar 19 01:29:12 2008 +0100| [afccd092f45c32f72a43283c725e939f173ec3c9]

objects.c: Automatically detach from the parent.

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

 src/misc/objects.c |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index 28f8d8f..fa1bfe0 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -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" );




More information about the vlc-devel mailing list