SDL: Fixed bug #7515 - Window still grabbed after destroying

From e494844e9a141ed53c487e9cf3e77c1f2205854e Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Tue, 28 Mar 2023 09:28:17 +0200
Subject: [PATCH] Fixed bug #7515 - Window still grabbed after destroying

---
 src/video/SDL_video.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index ab14c4f437e9..d3ba2495713b 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3454,6 +3454,10 @@ void SDL_DestroyWindow(SDL_Window *window)
         _this->DestroyWindow(_this, window);
     }
 
+    if (_this->grabbed_window == window) {
+        _this->grabbed_window = NULL; /* ungrabbing input. */
+    }
+
     /* Now invalidate magic */
     window->magic = NULL;