Fixed crash when the current mouse capture window is destroyed

Fixes https://github.com/libsdl-org/SDL/issues/10494

(cherry picked from commit 91d97a367e)
This commit is contained in:
Sam Lantinga committed 2024-08-07 12:28:53 -07:00
1 parent 81252eb06d
commit 5ca0639a42
1 file changed
+3
+3
View File
@@ -3312,6 +3312,9 @@ void SDL_DestroyWindow(SDL_Window *window)
if (SDL_GetKeyboardFocus() == window) {
SDL_SetKeyboardFocus(NULL);
}
if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
SDL_UpdateMouseCapture(SDL_TRUE);
}
if (SDL_GetMouseFocus() == window) {
SDL_SetMouseFocus(NULL);
}