[vlc-devel] commit: vlc_object_attach: do not kill an object within the structure lock ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Jun 11 18:26:01 CEST 2008

vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Jun 11 19:24:39 2008 +0300| [59e0425d59a9be5f496ada0d89ac7f1e0574d442]

vlc_object_attach: do not kill an object within the structure lock

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.

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

 src/misc/objects.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index b3829de..03bbd6a 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -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 );

More information about the vlc-devel mailing list