joy.cpl: Correct joystick testing thread behavior (try 2)

Lucas Zawacki lfzawacki at gmail.com
Mon Jul 16 12:05:39 CDT 2012


From: Lucas Zawacki <lfzawacki at gmail.com>

The problem with the original behavior is that it starts a new thread each time the test tab is switched to, but
only stopped them on PSN_RESET. Now when the window receives PSN_KILLACTIVE (cancel button, X button or tab switch) or 
PSN_RESET (ok button), the thread will rightfully die.

---
 dlls/joy.cpl/main.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index eb8f982..e9b3a72 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -424,9 +424,11 @@ static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
                 }
                 break;
 
-                case PSN_RESET:
+                case PSN_RESET: /* intentional fall-through */
+                case PSN_KILLACTIVE:
                     /* Stop input thread */
                     data->stop = TRUE;
+                    MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, 0);
                     CloseHandle(thread);
                 break;
             }
-- 
1.7.9.5




More information about the wine-patches mailing list