SDL: Safety fix: clear "_this->current_glwin" when destroying the window

From 0c048d98af449f1bc540e256c90eb792f1effff4 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Tue, 28 Mar 2023 09:48:58 +0200
Subject: [PATCH] Safety fix: clear "_this->current_glwin" when destroying the
 window

---
 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 d3ba2495713b..8de3b6fbbdfb 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3458,6 +3458,10 @@ void SDL_DestroyWindow(SDL_Window *window)
         _this->grabbed_window = NULL; /* ungrabbing input. */
     }
 
+    if (_this->current_glwin == window) {
+        _this->current_glwin = NULL;
+    }
+
     /* Now invalidate magic */
     window->magic = NULL;