Commit 99e8bcdd authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

objects: Don't lock parent in vlc_object_attach(). It creates quite hard to...

objects: Don't lock parent in vlc_object_attach(). It creates quite hard to resolve dead lock, and hopefully it is safe enough not to lock here. We only risk receiving kill event twice. But given current API it is ok.
parent 7c9181f6
......@@ -837,15 +837,18 @@ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
assert (!p_this->p_parent);
p_this->p_parent = p_parent;
vlc_object_lock( p_this->p_parent );
/* Attach the child to its parent */
vlc_object_internals_t *priv = vlc_internals( p_parent );
INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children,
p_this );
/* Kill the object if parent is already dead */
if( !vlc_object_alive( p_this->p_parent) )
/* 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_object_unlock( p_this->p_parent );
......
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