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 );