(try 5)[1/4] imm32: Move thread data from TLSEntry to an internal list

Alexandre Julliard julliard at winehq.org
Thu Sep 26 12:44:19 CDT 2013


Aric Stewart <aric at 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);
> +        ImmAssociateContext(hWnd,thread_data->defaultContext);
>          return TRUE;
>      case IACE_IGNORENOCONTEXT:
>          if (GetPropW(hWnd,szwWineIMCProperty))

You shouldn't be accessing thread data outside of the critical section.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list