Commit a35a7d2507c427540055c25bcddacda83c884d31

Edward Li 2021-12-25T05:00:26

Fix SigSegV from displayInfoInvalidate when changing resolution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 0daa3b6..5ed1f41 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -475,12 +475,9 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp
                     CGFloat height = CGDisplayModeGetPixelHeight(m);
                     CGFloat HiDPIWidth = CGDisplayModeGetWidth(m);
                     
-                    BOOL isNative = (CGDisplayModeGetIOFlags(m) & kDisplayModeNativeFlag) ? true : false;
-                    CFRelease(m);
-                    
                     //Only check 1x mode
                     if(width == HiDPIWidth) {
-                        if(isNative) {
+                        if (CGDisplayModeGetIOFlags(m) & kDisplayModeNativeFlag) {
                             displayNativeSize.width = width;
                             displayNativeSize.height = height;
                             break;