Skip to content

Properly initialize libxml2

Michał Kępień requested to merge michal/properly-initialize-libxml2 into master

When libxml2 is to be used in a multi-threaded application, the xmlInitThreads() function must be called before any other libxml2 function. This function does different things on various platforms and thus one can get away without calling it on Unix systems, but not on Windows, where it initializes critical section objects used for synchronizing access to data structures shared between threads. Add the missing xmlInitThreads() call to prevent crashes on affected systems.

Also add a matching xmlCleanupThreads() call to properly release the resources set up by xmlInitThreads().

Merge request reports