Skip to content

Commit 65df742

Browse files
committed
Fixed crash when trying to disconnect secondary display on iOS
1 parent d3a4d62 commit 65df742

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
@@ -695,7 +695,9 @@ void SDL_DelVideoDisplay(int index)
695695
SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0);
696696

697697
SDL_free(_this->displays[index].driverdata);
698+
_this->displays[index].driverdata = NULL;
698699
SDL_free(_this->displays[index].name);
700+
_this->displays[index].name = NULL;
699701
if (index < (_this->num_displays - 1)) {
700702
SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index]));
701703
}

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)