From 937e8d55a44c3f37cea99d8aff3a59b18a9e17de Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 11 Jul 2025 12:14:01 -0700
Subject: [PATCH] Set hwndTarget to NULL when unregistering raw input
Fixes https://github.com/libsdl-org/SDL/issues/13335
---
src/video/windows/SDL_windowsrawinput.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/video/windows/SDL_windowsrawinput.c b/src/video/windows/SDL_windowsrawinput.c
index fa249914d0f49..64c612cae9fa8 100644
--- a/src/video/windows/SDL_windowsrawinput.c
+++ b/src/video/windows/SDL_windowsrawinput.c
@@ -112,7 +112,9 @@ static DWORD WINAPI WIN_RawInputThread(LPVOID param)
}
devices[0].dwFlags |= RIDEV_REMOVE;
+ devices[0].hwndTarget = NULL;
devices[1].dwFlags |= RIDEV_REMOVE;
+ devices[1].hwndTarget = NULL;
RegisterRawInputDevices(devices, count, sizeof(devices[0]));
DestroyWindow(window);