[PATCH 3/8] msvcrt: Copy LC_COLLATE codepage between threadlocinfo instances.

Chip Davis cdavis at codeweavers.com
Mon Feb 3 16:34:08 CST 2020


February 3, 2020 10:51 AM, "Piotr Caban" <piotr.caban at gmail.com> wrote:

> Hi Chip,
> 
> On 2/2/20 11:55 PM, Chip Davis wrote:
> 
>> --- a/dlls/msvcrt/locale.c
>> +++ b/dlls/msvcrt/locale.c
>> @@ -1219,6 +1219,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
>> free_locinfo(locinfo);
>> return NULL;
>> }
>> + locinfo->lc_collate_cp = old_locinfo->lc_collate_cp;
> 
> Why do you need this? It should not be needed taking in account that this category is not being
> updated.

In patch 7, we stop updating the *contents* of the old locinfo, and instead update the locinfo pointer itself. This is needed so that the result of a _get_current_locale() call before a setlocale() call is unaffected by the setlocale() call. I needed that, in turn, because libc++ (from llvm-mingw) often calls _get_current_locale() before temporarily updating the global locale using setlocale(), and this bug was screwing up restoring the old locale. Demonstrating this is the case was the point of patch 1. For that to work, we have to copy the data for the un-updated parts from the old locinfo to the new one.

(Hmm... Perhaps I should've written a cover letter for this series.)


Chip



More information about the wine-devel mailing list