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