1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-27 03:21:26 +03:00

globals: Disable TLS in static Windows builds

The cleanup callback would run after TLS was deallocated.
This commit is contained in:
Nick Wellnhofer 2023-12-01 17:19:55 +01:00
parent c7629c9eb1
commit 4c17804050

View File

@ -100,8 +100,14 @@ static xmlMutex xmlThrDefMutex;
* On Darwin, thread-local storage destructors seem to be run before
* pthread thread-specific data destructors. This causes ASan to
* report a use-after-free.
*
* On Windows, we can't use TLS in static builds. The RegisterWait
* callback would run after TLS was deallocated.
*/
#if defined(XML_THREAD_LOCAL) && !defined(__APPLE__)
#if defined(XML_THREAD_LOCAL) && \
!defined(__APPLE__) && \
(!defined(HAVE_WIN32_THREADS) || \
!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#define USE_TLS
#endif