Skip to content

Commit d1af211

Browse files
jimtahuslouken
authored andcommitted
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 bee8874)
1 parent 6dcf757 commit d1af211

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/video/windows/SDL_windowsmodes.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,10 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info,
355355
display.driverdata = displaydata;
356356
WIN_GetDisplayBounds(_this, &display, &displaydata->bounds);
357357
index = SDL_AddVideoDisplay(&display, send_event);
358-
SDL_assert(index == *display_index);
359358
SDL_free(display.name);
360359

361360
done:
362-
*display_index += 1;
361+
*display_index = index + 1;
363362
}
364363

365364
typedef struct _WIN_AddDisplaysData

0 commit comments

Comments
 (0)