Skip to content

Commit 1650c02

Browse files
deveeeslouken
authored andcommitted
Fixed crash when trying to disconnect secondary display on iOS
(cherry picked from commit 934d695)
1 parent 97002d8 commit 1650c02

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/video/SDL_video.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,9 @@ void SDL_DelVideoDisplay(int index)
688688
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0);
689689

690690
SDL_free(_this->displays[index].driverdata);
691+
_this->displays[index].driverdata = NULL;
691692
SDL_free(_this->displays[index].name);
693+
_this->displays[index].name = NULL;
692694
if (index < (_this->num_displays - 1)) {
693695
SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index]));
694696
}

src/video/uikit/SDL_uikitmodes.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ void UIKit_DelDisplay(UIScreen *uiscreen)
344344

345345
if (data && data.uiscreen == uiscreen) {
346346
CFRelease(SDL_GetDisplayDriverData(i));
347+
SDL_GetDisplay(i)->driverdata = NULL;
347348
SDL_DelVideoDisplay(i);
348349
return;
349350
}

0 commit comments

Comments
 (0)