[vlc-devel] Latest build crashes under Windows on exit

Rémi Denis-Courmont rdenis at simphalempin.com
Sat May 17 13:02:17 CEST 2008


Le Saturday 17 May 2008 13:43:32 Pierre d'Herbemont, vous avez écrit :
> However, we are encountering the following:
> if *prior* to calling p_child->pf_destructor, something like
> vlc_find_object( p_child, FIND_PARENT ) is called (from an other
> thread then), p_child->p_parent->i_refcount is 0. We may yield it, and
> then assert() and fail.

That should return NULL.

> One idea, is to support in vlc_find_object() refcount set to zero (in
> fact only for FIND_PARENT, because object get's atomatically detached
> when their refcount reaches 0).

This cannot work. Once the refcount drops to zero, the object structure may 
become invalid at any time.

> We have to remember that we won't be using freed pointer objects, as
> before freeing() the useful part of the vlc_object_t, we do check if
> *no children* are remaining, and we never free( p_obj ) in that cases.
> So in regular uses, there shouldn't be any freed pointer uses.

You cannot assume that the thread calling vlc_find_object() is the same thread 
as that destroying the parent. If another thread has yield the child object 
for any reason... or, if the children object hosts its own thread... boom.

> An other idea, is to make sure that no objects uses FIND_PARENT... But
> I am not sure that's that easy.

Yeah, that would be very impractical.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list