Browse Source

cocoadisplay: Fix regression introduced by 45461e667a84b793048db0092596b5c23dbe6b38

Closes #829
LD 6 years ago
parent
commit
f68604a3f5
1 changed files with 5 additions and 3 deletions
  1. 5 3
      panda/src/cocoadisplay/cocoaGraphicsWindow.mm

+ 5 - 3
panda/src/cocoadisplay/cocoaGraphicsWindow.mm

@@ -1131,7 +1131,9 @@ find_display_mode(int width, int height) {
   }
   }
 #endif
 #endif
   CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, options);
   CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, options);
-  CFRelease(options);
+  if (options != NULL) {
+    CFRelease(options);
+  }
 
 
   size_t num_modes = CFArrayGetCount(modes);
   size_t num_modes = CFArrayGetCount(modes);
   CGDisplayModeRef mode;
   CGDisplayModeRef mode;
@@ -1166,12 +1168,12 @@ find_display_mode(int width, int height) {
 
 
     // As explained above, we want to select the fullscreen display mode using
     // As explained above, we want to select the fullscreen display mode using
     // the same scaling factor, but only for MacOS 10.15+ To do this we check
     // the same scaling factor, but only for MacOS 10.15+ To do this we check
-    // the mode width and heightbut also actual pixel widh and height.
+    // the mode width and height but also actual pixel widh and height.
     if (CGDisplayModeGetWidth(mode) == width &&
     if (CGDisplayModeGetWidth(mode) == width &&
         CGDisplayModeGetHeight(mode) == height &&
         CGDisplayModeGetHeight(mode) == height &&
         CGDisplayModeGetRefreshRate(mode) == refresh_rate &&
         CGDisplayModeGetRefreshRate(mode) == refresh_rate &&
 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
-        (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_14 ||
+        (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 ||
         (CGDisplayModeGetPixelWidth(mode) == expected_pixel_width &&
         (CGDisplayModeGetPixelWidth(mode) == expected_pixel_width &&
          CGDisplayModeGetPixelHeight(mode) == expected_pixel_height)) &&
          CGDisplayModeGetPixelHeight(mode) == expected_pixel_height)) &&
 #endif
 #endif