Fixed checking the return values of SDL_AddBasicVideoDisplay() and SDL_AddVideoDisplay()

Also fixed Wayland and Windows usage of SDL_DelVideoDisplay()

https://github.com/libsdl-org/SDL/issues/7192
This commit is contained in:
Sam Lantinga
2023-01-29 21:57:30 -08:00
parent 1ffc09c6e6
commit b07f8e987b
14 changed files with 36 additions and 22 deletions

View File

@@ -855,9 +855,10 @@ void WIN_RefreshDisplays(_THIS)
// Delete any entries still marked as invalid, iterate
// in reverse as each delete takes effect immediately
for (i = _this->num_displays - 1; i >= 0; --i) {
SDL_DisplayData *driverdata = _this->displays[i].driverdata;
SDL_VideoDisplay *display = &_this->displays[i];
SDL_DisplayData *driverdata = display->driverdata;
if (driverdata->IsValid == SDL_FALSE) {
SDL_DelVideoDisplay(i);
SDL_DelVideoDisplay(display->id);
}
}
}