From: Fabian Maurer dark.shadow4@web.de
We need to make sure all (important) cleanup is finished when we exit DllMain, otherwise we might already unload krnl386 and deadlock Since we can't have a synchronous DestroyWindow, use an extra message
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52511 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/imm32/imm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 780d544c0e9..3a334bc0de5 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -51,6 +51,7 @@ static UINT WM_MSIME_RECONVERTREQUEST; static UINT WM_MSIME_RECONVERT; static UINT WM_MSIME_QUERYPOSITION; static UINT WM_MSIME_DOCUMENTFEED; +static UINT WM_WINE_IME_DESTROY;
typedef struct _tagImmHkl{ struct list entry; @@ -554,7 +555,10 @@ static void IMM_FreeAllImmHkl(void) FreeLibrary(ptr->hIME); } if (ptr->UIWnd) + { + SendMessageA(ptr->UIWnd, WM_WINE_IME_DESTROY, 0, 0); DestroyWindow(ptr->UIWnd); + } HeapFree(GetProcessHeap(),0,ptr); } } @@ -3185,6 +3189,7 @@ static void init_messages(void) WM_MSIME_RECONVERT = RegisterWindowMessageW(L"MSIMEReconvert"); WM_MSIME_QUERYPOSITION = RegisterWindowMessageW(L"MSIMEQueryPosition"); WM_MSIME_DOCUMENTFEED = RegisterWindowMessageW(L"MSIMEDocumentFeed"); + WM_WINE_IME_DESTROY = RegisterWindowMessageW(L"__WINE_IME_DESTROY"); initialized = TRUE; }
@@ -3198,16 +3203,18 @@ LRESULT WINAPI __wine_ime_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp init_messages(); return TRUE;
- case WM_DESTROY: + case WM_IME_INTERNAL: + return ime_internal_msg(wparam, lparam); + } + + if (msg == WM_WINE_IME_DESTROY) + { + HWND default_hwnd = ImmGetDefaultIMEWnd(0); + if (!default_hwnd || hwnd == default_hwnd) { - HWND default_hwnd = ImmGetDefaultIMEWnd(0); - if (!default_hwnd || hwnd == default_hwnd) - imm_couninit_thread(TRUE); + imm_couninit_thread(TRUE); } return TRUE; - - case WM_IME_INTERNAL: - return ime_internal_msg(wparam, lparam); }
if (is_ime_ui_msg(msg))