Vitaliy Margolen wine-patch@kievinfo.com writes:
+static void release_hook_thread(void) +{
- LONG ref;
 - EnterCriticalSection(&dinput_hook_crit);
 - ref = --hook_thread_refcount;
 - TRACE("Releasing to %ld\n", ref);
 - if (ref == 0) SendMessageW(hook_thread_hwnd, WM_DESTROY, 0, 0);
 
WM_DESTROY is supposed to be sent by DestroyWindow, sending it manually is not very nice, you should use a WM_USER message instead. Also you need to clear hook_thread_hwnd first, otherwise there's a race since you don't wait for the thread to finish.