Fix SigSegV from displayInfoInvalidate when changing resolution

This commit is contained in:
Edward Li 2021-12-25 05:00:26 +08:00 committed by Sam Lantinga
parent 1c41b53551
commit a35a7d2507

View file

@ -475,12 +475,9 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp
CGFloat height = CGDisplayModeGetPixelHeight(m); CGFloat height = CGDisplayModeGetPixelHeight(m);
CGFloat HiDPIWidth = CGDisplayModeGetWidth(m); CGFloat HiDPIWidth = CGDisplayModeGetWidth(m);
BOOL isNative = (CGDisplayModeGetIOFlags(m) & kDisplayModeNativeFlag) ? true : false;
CFRelease(m);
//Only check 1x mode //Only check 1x mode
if(width == HiDPIWidth) { if(width == HiDPIWidth) {
if(isNative) { if (CGDisplayModeGetIOFlags(m) & kDisplayModeNativeFlag) {
displayNativeSize.width = width; displayNativeSize.width = width;
displayNativeSize.height = height; displayNativeSize.height = height;
break; break;