# SDL: Safety fix: clear "\_this-\>wakeup\_window" when destroying the window

**URL:** <https://discourse.libsdl.org/t/sdl-safety-fix-clear-this-wakeup-window-when-destroying-the-window/43376>\
**Category:** SDL Commits\
**Created:** [March 28, 2023, 3:30pm UTC](https://discourse.libsdl.org/t/sdl-safety-fix-clear-this-wakeup-window-when-destroying-the-window/43376 "2023-03-28T15:30:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [March 28, 2023, 3:30pm UTC](https://discourse.libsdl.org/t/sdl-safety-fix-clear-this-wakeup-window-when-destroying-the-window/43376/1 "2023-03-28T15:30:10Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/c838ccf0e3a330ebbcf433698b8f5370c6fa80d6>

```diff
From c838ccf0e3a330ebbcf433698b8f5370c6fa80d6 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Tue, 28 Mar 2023 09:49:45 +0200
Subject: [PATCH] Safety fix: clear "_this->wakeup_window" 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 8de3b6fbbdfb..2ead29e6d047 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3462,6 +3462,10 @@ void SDL_DestroyWindow(SDL_Window *window)
         _this->current_glwin = NULL;
     }
 
+ if (_this->wakeup_window == window) {
+ _this->wakeup_window = NULL;
+ }
+
     /* Now invalidate magic */
     window->magic = NULL;
 

```
