Commit a9565f33 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

objects: Make sure that we don't loose a vlc_object_kill() when attaching to a...

objects: Make sure that we don't loose a vlc_object_kill() when attaching to a dead or dying parent.

Note: We do need to lock the parent for that.
parent 60d60225
...@@ -837,11 +837,19 @@ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent ) ...@@ -837,11 +837,19 @@ void __vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
assert (!p_this->p_parent); assert (!p_this->p_parent);
p_this->p_parent = p_parent; p_this->p_parent = p_parent;
vlc_object_lock( p_this->p_parent );
/* Attach the child to its parent */ /* Attach the child to its parent */
vlc_object_internals_t *priv = vlc_internals( p_parent ); vlc_object_internals_t *priv = vlc_internals( p_parent );
INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children, INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children,
p_this ); p_this );
/* Kill the object if parent is already dead */
if( !vlc_object_alive( p_this->p_parent) )
vlc_object_kill( p_this );
vlc_object_unlock( p_this->p_parent );
vlc_mutex_unlock( &structure_lock ); 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