summaryrefslogtreecommitdiff
path: root/gdk/quartz/gdkwindow-quartz.c
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2014-10-10 21:35:23 -0700
committerJohn Ralls <jralls@ceridwen.us>2014-12-24 14:57:40 -0800
commitec37fbe2e29a7a02502f9a9d499a707f208e01d6 (patch)
treeadfff158b3636e293f3dd9df7306847152664a38 /gdk/quartz/gdkwindow-quartz.c
parent4bd787f2afe14233e183fcfac7103cf9597ca50a (diff)
downloadgtk+-ec37fbe2e29a7a02502f9a9d499a707f208e01d6.tar.gz
quartz: NSWindow NULL check in get_scale_factor
Sending backingScaleFactor to a NULL NSWindow will silently give the value 0 for the scale factor, causing insidious divide-by-zero bugs down the line. This checks if the NSWindow is NULL first, as seems to happen throughout the rest of the file. Note that I don't have a hi-DPI OS X machine to test this on, though. https://bugzilla.gnome.org/show_bug.cgi?id=738338
Diffstat (limited to 'gdk/quartz/gdkwindow-quartz.c')
-rw-r--r--gdk/quartz/gdkwindow-quartz.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 468bc8b60f..2a2444ef74 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2852,7 +2852,7 @@ gdk_quartz_window_get_scale_factor (GdkWindow *window)
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
- if (gdk_quartz_osx_version() >= GDK_OSX_LION)
+ if (impl->toplevel != NULL && gdk_quartz_osx_version() >= GDK_OSX_LION)
return [(id <ScaleFactor>) impl->toplevel backingScaleFactor];
return 1;