Commit 70b7b894 authored by John Ralls's avatar John Ralls

[Quartz]Check mode before setting the monitor scale factor.

CGDisplayModeGetWidth returns 0 if mode is NULL; that happens if the
CGDisplay is offline or mirroring another monitor and it leads to a
divide-by-zero crash.

Closes: #1565
parent a8e07254
Pipeline #49382 passed with stage
in 6 minutes and 4 seconds
......@@ -253,14 +253,16 @@ configure_monitor (GdkMonitor *monitor)
monitor->height_mm = height;
monitor->geometry = disp_geometry;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (gdk_quartz_osx_version () >= GDK_OSX_MOUNTAIN_LION)
if (mode && gdk_quartz_osx_version () >= GDK_OSX_MOUNTAIN_LION)
{
monitor->scale_factor = CGDisplayModeGetPixelWidth (mode) / CGDisplayModeGetWidth (mode);
CGDisplayModeRelease (mode);
}
else
#endif
monitor->scale_factor = 1;
monitor->refresh_rate = refresh_rate;
monitor->subpixel_layout = GDK_SUBPIXEL_LAYOUT_UNKNOWN;
CGDisplayModeRelease (mode);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment