[PATCH] msvcrt: Duplicate the secondary structs in _get_current_locale().

Piotr Caban piotr.caban at gmail.com
Mon Jan 27 07:27:52 CST 2020


Hi Chip,

On 1/27/20 3:18 AM, Chip Davis wrote:
>   MSVCRT__locale_t CDECL MSVCRT__get_current_locale(void)
>   {
> +    int i;
>       MSVCRT__locale_t loc = MSVCRT_malloc(sizeof(MSVCRT__locale_tstruct));
>       if(!loc)
>           return NULL;
>   
> -    loc->locinfo = get_locinfo();
> -    loc->mbcinfo = get_mbcinfo();
> -    InterlockedIncrement(&loc->locinfo->refcount);
> -    InterlockedIncrement(&loc->mbcinfo->refcount);
> +    loc->locinfo = MSVCRT_malloc(sizeof(MSVCRT_threadlocinfo));
> +    loc->mbcinfo = MSVCRT_malloc(sizeof(MSVCRT_threadmbcinfo));
A quick testing shows that consecutive  _get_current_locale calls return 
identical locinfo/mbcinfo pointers. It's probably the setlocale function 
that needs to not reuse some strctures when refcount was icreased.

Thanks,
Piotr



More information about the wine-devel mailing list