Aric Stewart aric@codeweavers.com writes:
@@ -530,12 +591,18 @@ static BOOL CALLBACK _ImmAssociateContextExEnumProc(HWND hwnd, LPARAM lParam) */ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) {
- IMMThreadData* thread_data = NULL;
- TRACE("(%p, %p, 0x%x):\n", hWnd, hIMC, dwFlags);
- if (!IMM_GetThreadData()->defaultContext)
IMM_GetThreadData()->defaultContext = ImmCreateContext();
- thread_data = IMM_GetInitializedThreadData();
- if (!thread_data)
return FALSE;
- if (!hWnd) return FALSE;
LeaveCriticalSection(&threaddata_cs);
if (!hWnd)
return FALSE;
switch (dwFlags) {
@@ -543,7 +610,7 @@ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) ImmAssociateContext(hWnd,hIMC); return TRUE; case IACE_DEFAULT:
ImmAssociateContext(hWnd,IMM_GetThreadData()->defaultContext);
case IACE_IGNORENOCONTEXT: if (GetPropW(hWnd,szwWineIMCProperty))ImmAssociateContext(hWnd,thread_data->defaultContext); return TRUE;
You shouldn't be accessing thread data outside of the critical section.