From 3b17d08eb292583ee0668b6b9ad29c3ad89d5200 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 16 Apr 2025 12:47:29 -0400
Subject: [PATCH] win32: Check internal data when positioning child windows
Under certain circumstances, processing events may try to position a child before it is fully initialized. Check the internal data before proceeding.
(cherry picked from commit 9da46bc37fb9920f5ee12b187f165a30339985cc)
---
src/video/windows/SDL_windowswindow.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 355b7c2fd2602..fe21fa7e9b201 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -348,6 +348,10 @@ bool WIN_SetWindowPositionInternal(SDL_Window *window, UINT flags, SDL_WindowRec
// Update any child windows
for (child_window = window->first_child; child_window; child_window = child_window->next_sibling) {
+ if (!child_window->internal) {
+ // This child window is not yet fully initialized.
+ continue;
+ }
if (!WIN_SetWindowPositionInternal(child_window, flags, SDL_WINDOWRECT_CURRENT)) {
result = false;
}