# SDL: video: hide window before destroying properties

**URL:** <https://discourse.libsdl.org/t/sdl-video-hide-window-before-destroying-properties/51287>\
**Category:** SDL Commits\
**Created:** [May 17, 2024, 12:40pm UTC](https://discourse.libsdl.org/t/sdl-video-hide-window-before-destroying-properties/51287 "2024-05-17T12:40:14Z")\
**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:** [May 17, 2024, 12:40pm UTC](https://discourse.libsdl.org/t/sdl-video-hide-window-before-destroying-properties/51287/1 "2024-05-17T12:40:14Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/a7d4ee05f6305a16c9256e12f89096ea7027642f>
>
> This fixes a few "DEBUG: Parameter 'props' is invalid" messages, when exiting te…stcamera.

```diff
From a7d4ee05f6305a16c9256e12f89096ea7027642f Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 13 May 2024 16:11:25 +0200
Subject: [PATCH] video: hide window before destroying properties

This fixes a few "DEBUG: Parameter 'props' is invalid" messages, when exiting testcamera.
---
 src/video/SDL_video.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index f77e24add6caf..bfe79182a18db 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3757,6 +3757,12 @@ void SDL_DestroyWindow(SDL_Window *window)
         SDL_DestroyRendererWithoutFreeing(renderer);
     }
 
+ /* Restore video mode, etc. */
+ SDL_UpdateFullscreenMode(window, SDL_FALSE, SDL_TRUE);
+ if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
+ SDL_HideWindow(window);
+ }
+
     SDL_DestroyProperties(window->props);
 
     /* Clear the modal status, but don't unset the parent, as it may be
@@ -3767,12 +3773,6 @@ void SDL_DestroyWindow(SDL_Window *window)
         _this->SetWindowModalFor(_this, window, NULL);
     }
 
- /* Restore video mode, etc. */
- SDL_UpdateFullscreenMode(window, SDL_FALSE, SDL_TRUE);
- if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
- SDL_HideWindow(window);
- }
-
     /* Make sure the destroyed window isn't referenced by any display as a fullscreen window. */
     for (int i = 0; i < _this->num_displays; ++i) {
         if (_this->displays[i]->fullscreen_window == window) {

```
