]> git.sesse.net Git - vlc/commitdiff
vlc_object_attach: do not kill an object within the structure lock
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 11 Jun 2008 16:24:39 +0000 (19:24 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 11 Jun 2008 16:24:39 +0000 (19:24 +0300)
Killing a the parent within vlc_object_attach looks like an awful hack
anyway. And there was a documented race condition, in addition to the
dead lock.

This reverts all the pluses from 99e8bcdd. vlc_object_kill() takes the
structure lock internally (through vlc_list_child()), so this would
always deadlock. Besides, we cannot take any lock within the structure
lock, lest we forbid any thread from ever manipulating the objects
structure while holding a lock on any object.
AFAIK, only object reference spins and the messages bank can be locked
within the structure lock.

src/misc/objects.c

index b3829de135c6dfb07e5a6db501dc00e628624db4..03bbd6a245c7b2fed4b5d7d065c198f86f76b7b6 100644 (file)
@@ -905,15 +905,6 @@ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
     INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children,
                  p_this );
 
-    /* Kill the object if parent is already dead.
-     * Note: We should surely lock parent here, but that would
-     * create quite a few dead lock case. Hopefully, it
-     * is perfectly safe to do it that way. We only risk
-     * receiving kill event twice. But given current API
-     * it is ok. */
-    if( p_this->p_parent->b_die )
-        vlc_object_kill( p_this );
-
     vlc_mutex_unlock( &structure_lock );
 }