Piotr Caban : imm32: Don' t use functions that use graphics driver in THREAD_DETACH/PROCESS_DETACH.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 28 07:42:28 CDT 2015


Module: wine
Branch: master
Commit: 60b996ad4b46be7c50784d4a0382060845893b85
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60b996ad4b46be7c50784d4a0382060845893b85

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Aug 27 16:16:09 2015 +0200

imm32: Don't use functions that use graphics driver in THREAD_DETACH/PROCESS_DETACH.

---

 dlls/imm32/imm.c         |  1 -
 dlls/imm32/tests/imm32.c | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 3629024..3fab6fc 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -270,7 +270,6 @@ static void IMM_FreeThreadData(void)
             list_remove(&data->entry);
             LeaveCriticalSection(&threaddata_cs);
             IMM_DestroyContext(data->defaultContext);
-            DestroyWindow(data->hwndDefault);
             HeapFree(GetProcessHeap(),0,data);
             TRACE("Thread Data Destroyed\n");
             return;
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 870f5d2..b1f3913 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -782,10 +782,29 @@ static void test_ImmGetDescription(void)
     UnloadKeyboardLayout(hkl);
 }
 
+static LRESULT (WINAPI *old_imm_wnd_proc)(HWND, UINT, WPARAM, LPARAM);
+static LRESULT WINAPI imm_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    ok(msg != WM_DESTROY, "got WM_DESTROY message\n");
+    return old_imm_wnd_proc(hwnd, msg, wparam, lparam);
+}
+
+static HWND thread_ime_wnd;
+static DWORD WINAPI test_ImmGetDefaultIMEWnd_thread(void *arg)
+{
+    CreateWindowA("static", "static", WS_POPUP, 0, 0, 1, 1, NULL, NULL, NULL, NULL);
+
+    thread_ime_wnd = ImmGetDefaultIMEWnd(0);
+    ok(thread_ime_wnd != 0, "ImmGetDefaultIMEWnd returned NULL\n");
+    old_imm_wnd_proc = (void*)SetWindowLongPtrW(thread_ime_wnd, GWLP_WNDPROC, (LONG_PTR)imm_wnd_proc);
+    return 0;
+}
+
 static void test_ImmDefaultHwnd(void)
 {
     HIMC imc1, imc2, imc3;
     HWND def1, def3;
+    HANDLE thread;
     HWND hwnd;
 
     hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
@@ -813,6 +832,11 @@ static void test_ImmDefaultHwnd(void)
     ok(imc1 == imc3, "IME context should not change\n");
     ImmSetOpenStatus(imc2, FALSE);
 
+    thread = CreateThread(NULL, 0, test_ImmGetDefaultIMEWnd_thread, NULL, 0, NULL);
+    WaitForSingleObject(thread, INFINITE);
+    ok(thread_ime_wnd != def1, "thread_ime_wnd == def1\n");
+    ok(!IsWindow(thread_ime_wnd), "thread_ime_wnd was not destroyed\n");
+
     ImmReleaseContext(hwnd, imc1);
     ImmReleaseContext(hwnd, imc3);
     ImmDestroyContext(imc2);




More information about the wine-cvs mailing list