Dec. 31, 2023
11:42 a.m.
Piotr Caban (@piotr) commented about dlls/msvcrt/locale.c:
*/ char* CDECL setlocale(int category, const char* locale) { - thread_data_t *data = msvcrt_get_thread_data(); - pthreadlocinfo locinfo = get_locinfo(), newlocinfo; + thread_data_t *data; + pthreadlocinfo locinfo, newlocinfo; + + _lock_locales(); While this change works we should limit the time when _lock_locales lock is held. It can be achieved by acquiring the lock, increasing locale refcounts and releasing the lock (there's `grab_locinfo` helper that does that).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4654#note_56511