Commit 59e0425d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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.
parent 0b06fc57
......@@ -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 );
}
......
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