mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-27 10:57:22 +08:00
Fixed crash when trying to disconnect secondary display on iOS
This commit is contained in:
@@ -695,7 +695,9 @@ void SDL_DelVideoDisplay(int index)
|
|||||||
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0);
|
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0);
|
||||||
|
|
||||||
SDL_free(_this->displays[index].driverdata);
|
SDL_free(_this->displays[index].driverdata);
|
||||||
|
_this->displays[index].driverdata = NULL;
|
||||||
SDL_free(_this->displays[index].name);
|
SDL_free(_this->displays[index].name);
|
||||||
|
_this->displays[index].name = NULL;
|
||||||
if (index < (_this->num_displays - 1)) {
|
if (index < (_this->num_displays - 1)) {
|
||||||
SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index]));
|
SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ void UIKit_DelDisplay(UIScreen *uiscreen)
|
|||||||
|
|
||||||
if (data && data.uiscreen == uiscreen) {
|
if (data && data.uiscreen == uiscreen) {
|
||||||
CFRelease(SDL_GetDisplayDriverData(i));
|
CFRelease(SDL_GetDisplayDriverData(i));
|
||||||
|
SDL_GetDisplay(i)->driverdata = NULL;
|
||||||
SDL_DelVideoDisplay(i);
|
SDL_DelVideoDisplay(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user