[vlc-devel] [PATCH] -- solve skins2 crash at termination (libxml2 and libqt4 issues)

Rémi Denis-Courmont remi at remlab.net
Tue Feb 23 21:33:54 CET 2010


----- Message d'origine -----
>      These two libraries spawn a thread that wakes up when their initiator
> thread terminates.
>      These threads are intended to do some final cleaning then terminate.

Linking those libraries dynamically looks like the proper solution. Then they can use DllEntry(). I do not need to mention that libxml2 is linked into multiple places... Of course, nobody wants to bother "fixing" this Win32. It involves changing the plugin loader, the contribs *and* the configure script. Also, dynamically linked libraries can use DllEntry(); but that does not mean they do.

Alternativelyp we could just patch those libraies to not suck. We cannot afford it on Linux, but we can on Windows as a consequence of our contribs.

>      Using 'linked_with_a_crap_library_which_uses_atexit()' is a solution
> to the problem. Actually, it just
>      defers freeing dlls at vlc termination. This does solve all skins2
> problems (no more crashes).

This is not really correct either. I do not know the Win32 behaviour for unterminated threads when the main thread exits.

>      Any objection to apply this patch ?

Fine with me, for lack of a cleaner alternative.

>      As a side note, concerning libxml2, another problem exists that makes
> vlc bound to crash on Win32
>      if several threads are using xml concurrently. (xmlInitParser()
> should be started in main thread
>      at init of vlc, because of this 'cleanup' thread that wakes up when
> its initiator thread terminates.
>      if initiator is a child thread, global ressouces get freed while
> another thread is using them ....)

We cannot fix that in (lib)VLC. LibVLC may de loaded dynamically (e.g. Web plugins) and/or started from a non main thread. Besides, it would only work if libxml2 were linked dynamically, such that all of its instances share the same static storage. Currently, we have one copy of libxml2 per plugin that links to it - on Windows.

-- 
Rémi



More information about the vlc-devel mailing list