diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index b31e8bc78ae..6fbb3201200 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -45,6 +45,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(variant); +static CRITICAL_SECTION cache_cs; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &cache_cs, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": cache_cs") } +}; +static CRITICAL_SECTION cache_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; + /* Convert a variant from one type to another */ static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags, VARIANTARG* ps, VARTYPE vt) @@ -1490,7 +1499,6 @@ HRESULT WINAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *lpUdate) static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID lcid, DWORD dwFlags) { static const VARIANT_NUMBER_CHARS defaultChars = { '-','+','.',',','$',0,'.',',' }; - static CRITICAL_SECTION csLastChars = { NULL, -1, 0, 0, 0, 0 }; static VARIANT_NUMBER_CHARS lastChars; static LCID lastLcid = -1; static DWORD lastFlags = 0; @@ -1498,14 +1506,14 @@ static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID WCHAR buff[4]; /* To make caching thread-safe, a critical section is needed */ - EnterCriticalSection(&csLastChars); + EnterCriticalSection(&cache_cs); /* Asking for default locale entries is very expensive: It is a registry server call. So cache one locally, as Microsoft does it too */ if(lcid == lastLcid && dwFlags == lastFlags) { memcpy(lpChars, &lastChars, sizeof(defaultChars)); - LeaveCriticalSection(&csLastChars); + LeaveCriticalSection(&cache_cs); return; } @@ -1532,7 +1540,7 @@ static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID memcpy(&lastChars, lpChars, sizeof(defaultChars)); lastLcid = lcid; lastFlags = dwFlags; - LeaveCriticalSection(&csLastChars); + LeaveCriticalSection(&cache_cs); } /* Number Parsing States */