From: Brendan Shanks <bshanks@codeweavers.com> --- dlls/joy.cpl/wginput.c | 2 ++ dlls/joy.cpl/xinput.c | 1 + 2 files changed, 3 insertions(+) diff --git a/dlls/joy.cpl/wginput.c b/dlls/joy.cpl/wginput.c index a7977ff8eb1..f6bb57b65e4 100644 --- a/dlls/joy.cpl/wginput.c +++ b/dlls/joy.cpl/wginput.c @@ -680,11 +680,13 @@ extern INT_PTR CALLBACK test_wgi_dialog_proc( HWND hwnd, UINT msg, WPARAM wparam case PSN_RESET: case PSN_KILLACTIVE: + if (!thread) break; SetEvent( thread_stop ); MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, 0 ); CloseHandle( state_event ); CloseHandle( thread_stop ); CloseHandle( thread ); + thread = NULL; clear_devices(); diff --git a/dlls/joy.cpl/xinput.c b/dlls/joy.cpl/xinput.c index 977c3ecd2d6..6919a8807aa 100644 --- a/dlls/joy.cpl/xinput.c +++ b/dlls/joy.cpl/xinput.c @@ -431,6 +431,7 @@ extern INT_PTR CALLBACK test_xi_dialog_proc( HWND hwnd, UINT msg, WPARAM wparam, case PSN_RESET: case PSN_KILLACTIVE: + if (!dialog_hwnd) break; SetEvent( thread_stop ); /* wait for the input thread to stop, processing any WM_USER message from it */ while (MsgWaitForMultipleObjects( 1, &thread, FALSE, INFINITE, QS_ALLINPUT ) == 1) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10136