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

Pierre d'Herbemont pdherbemont at free.fr
Sat May 17 12:43:32 CEST 2008

Hi Rémi,

On May 17, 2008, at 10:23 AM, Rémi Denis-Courmont wrote:

> Le Friday 16 May 2008 21:35:12 jboileau, vous avez écrit :
>> I don't know if issue this is known. The latest build crashes on exit
>> under Windows with the message 'Runtime Error!'. If this a known  
>> issue
>> disregard this email, it is to be expected in the middle of
>> development. If it is not known, I can enter a ticket if needed.
>> There isn't anything special to do. Just starting VLC and closing it
>> without any other operation will crash.
> This should work around the problem (works for me). But I currently  
> believe
> that this is working around a bug rather than actually fixing it.

I think this is fine.

Yet, I kind of prefer the solution where we track if they are  
remaining children attached to the object we release.

For that we must *not* set the p_parent members of the p_children to  
NULL before calling the object destructor, hence each child can call  
vlc_object_detach() on itself.

As funman would appreciate, here, is a simple ASCII art of what we are  
trying to achieve:


vlc_object_release( p_obj )
			vlc_object_release( p_obj->p_child1 )
				vlc_object_detach( p_obj->p_child1 ) (non no-op version)...
			vlc_object_release( p_obj->p_child2 )
				vlc_object_detach( p_obj->p_child2 ) (non no-op version)...
		// Now we can track child leak

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.

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

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.

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


More information about the vlc-devel mailing list