From d1af211010adb1030ce04860437fd5a580cf8eed Mon Sep 17 00:00:00 2001
From: jimtahu <[EMAIL REDACTED]>
Date: Fri, 15 Nov 2024 14:48:53 -0600
Subject: [PATCH] Always Use Next Display Index
WIN_AddDisplay asserted that the returned index is the expected next
one in the list. This can be an unexpected number when displays are
add and removed in a batch (eg, Remote Desktop disconnect and reconnect).
Instead always just make use of the next index, even if it is not the
expected next index value. This fixes issue #9105
(cherry picked from commit bee8874629409aad58d334ea0fcfd03921626166)
---
src/video/windows/SDL_windowsmodes.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c
index 372571c53bc06..05df48ae4d130 100644
--- a/src/video/windows/SDL_windowsmodes.c
+++ b/src/video/windows/SDL_windowsmodes.c
@@ -355,11 +355,10 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info,
display.driverdata = displaydata;
WIN_GetDisplayBounds(_this, &display, &displaydata->bounds);
index = SDL_AddVideoDisplay(&display, send_event);
- SDL_assert(index == *display_index);
SDL_free(display.name);
done:
- *display_index += 1;
+ *display_index = index + 1;
}
typedef struct _WIN_AddDisplaysData