Always Use Next Display Index
Some checks are pending
Build (Android) / CMake (push) Waiting to run
Build (Android) / Android.mk (push) Waiting to run
Build (C/P Actions) / FreeBSD (push) Waiting to run
Build (Emscripten) / emscripten (push) Waiting to run
Build (iOS/tvOS) / iOS (push) Waiting to run
Build (iOS/tvOS) / tvOS (push) Waiting to run
Build / Intel Compiler (Ubuntu 20.04) (push) Waiting to run
Build / Intel oneAPI (Ubuntu 20.04) (push) Waiting to run
Build / MacOS (autotools) (push) Waiting to run
Build / Ubuntu 20.04 (autotools) (push) Waiting to run
Build / Ubuntu 22.04 (autotools) (push) Waiting to run
Build / MacOS (CMake) (push) Waiting to run
Build / iOS (CMake) (push) Waiting to run
Build / tvOS (CMake) (push) Waiting to run
Build / Windows (clang32) (push) Waiting to run
Build / Windows (clang64) (push) Waiting to run
Build / Windows (mingw32) (push) Waiting to run
Build / Windows (ucrt64) (push) Waiting to run
Build / Windows (mingw64) (push) Waiting to run
Build / Ubuntu 20.04 (CMake) (push) Waiting to run
Build / Ubuntu 22.04 (CMake) (push) Waiting to run
Build (MSVC) / GDK (x64) (push) Waiting to run
Build (MSVC) / UWP (x64) (push) Waiting to run
Build (MSVC) / Windows (ARM) (push) Waiting to run
Build (MSVC) / Windows (ARM64) (push) Waiting to run
Build (MSVC) / Windows (x64) (push) Waiting to run
Build (MSVC) / Windows (x86) (push) Waiting to run
Build (MSVC) / Windows (clang-cl x64) (push) Waiting to run
Build (MSVC) / Windows (clang-cl x86) (push) Waiting to run
Build (MSVC) / Windows static VCRT (x64) (push) Waiting to run
Build (MSVC) / Windows static VCRT (x86) (push) Waiting to run
Build (Nintendo 3DS) / n3ds (push) Waiting to run
Build (Sony Playstation 2) / ps2 (push) Waiting to run
Build (Sony Playstation Portable) / psp (push) Waiting to run
Build (RISC OS) / CMake (push) Waiting to run
Build (RISC OS) / autotools (push) Waiting to run
Build (Sony Playstation Vita) / GLES (PVR_PSP2 + gl4es4vita) (push) Waiting to run
Build (Sony Playstation Vita) / GLES (pib) (push) Waiting to run
Build (OpenWatcom) / OS/2 (push) Waiting to run
Build (OpenWatcom) / Windows (push) Waiting to run

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 bee8874629)
This commit is contained in:
jimtahu 2024-11-15 14:48:53 -06:00 committed by Sam Lantinga
parent 6dcf75710c
commit d1af211010

View file

@ -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