[vlc-devel] More bugs...hurrah!

mlist at marxbitware.com mlist at marxbitware.com
Wed Jun 18 09:49:58 CEST 2008


Quoting Pierre d'Herbemont <pdherbemont at free.fr>:

>
> On Jun 18, 2008, at 3:57 AM, mlist at marxbitware.com wrote:
>
>> Quoting Pierre d'Herbemont <pdherbemont at free.fr>:
>>
>>>
>> So, the documentation is slightly out-of-date then?
>
> yeah :)
>

That's cool, I'll work it out as I go along.

>>>> HEAP[Marx Media Player v2.exe]: Invalid address specified to
>>>> RtlFreeHeap( 00090000, 05C25E78 )
>>>> HEAP[Marx Media Player v2.exe]: Invalid address specified to
>>>> RtlFreeHeap( 009B0000, 078A61E0 )
>>>
>>> Huh?
>>>
>>
>> My debugger is working with the assembly and these errors corrupt   
>> the heap.  I'm running Vista and debugging compiled DLLs.
>
> Then the explanation is that the exception you passed wasn't initialized.
>
>>>> IMPORTANT:  Ok, since I wrote all that above, I tried executing   
>>>> libvlc_exception_init(ref ex); after each function call to clear   
>>>> the struct.  This did the trick.  If you pass the exception   
>>>> struct from the wrapper to a function and it already contains   
>>>> data (such as a previous exception), it will corrupt the heap.
>>
>> libvlc_exception_init(ref ex) must be used after every function   
>> that passes the ref struct to delete the contents.
>
> Normally you need to init only once. I have some concerns about your
> wrapper then. Exception should be handled by the wrapper itself, not by
> you (you should only handle native exceptions, not libvlc's).
>>

I didn't phrase that right.  If an exception is raised,  
libvlc_exception_init(ref ex) must be used to clear the struct before  
it can be passed to a function again.

This wouldn't be part of the wrapper, as it only exposes the commands  
provided by the API.  This would be done as part of the function that  
handles an exception when it is raised.

So, in my media player I would check using libvlc_exception_raised(ref  
ex), then take some action, finally either call  
libvlc_exception_init(ref ex) or possibly libvlc_exception_clear(ref  
ex) before attempting to continue.

>> That said, the exception still occurs although now we don't get a   
>> second problem of the struct contents corrupting the heap:
>>
>> libvlc_video_set_parent(libvlc_core_handle, hDT, ref ex);
>>
>> b_raised = 1
>> i_code = 0
>> psz_message = "No active input"
>
> Damned, I couldn't understand why you were getting that one... Well,
> that's because I forgot to commit one of my local change. Should be
> fixed in latest git.
>
> Thanks!
>
> Pierre.

Excellent, I'll test it and let you know the result.




More information about the vlc-devel mailing list