summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMichael Natterer <mitch@gimp.org>2012-11-29 14:44:04 +0100
committerMichael Natterer <mitch@gimp.org>2012-11-29 15:02:19 +0100
commitcfe1b0263ffb3b72ead2b05491b9fdd1e0b1b997 (patch)
tree9205b427a5e11890b5fd412e2c225b95ddac458e /gdk
parent885d028c2009e9a5d6fd823cee85a0a268f19904 (diff)
downloadgtk+-cfe1b0263ffb3b72ead2b05491b9fdd1e0b1b997.tar.gz
quartz: call Gestalt() only once per session in gdk_quartz_osx_version()
Thanks to Paul Davis for pointing this out. (cherry picked from commit d6533ffc44d77b42cce7987f249fa481581b7c50)
Diffstat (limited to 'gdk')
-rw-r--r--gdk/quartz/gdkglobals-quartz.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
index a185d2a79a..c6a7a227bb 100644
--- a/gdk/quartz/gdkglobals-quartz.c
+++ b/gdk/quartz/gdkglobals-quartz.c
@@ -28,9 +28,14 @@ GdkWindow *_gdk_root = NULL;
GdkOSXVersion
gdk_quartz_osx_version (void)
{
- gint minor;
- OSErr err = Gestalt (gestaltSystemVersionMinor, &minor);
- g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
+ static gint32 minor = 0;
+
+ if (!minor)
+ {
+ OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
+
+ g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
+ }
if (minor < GDK_OSX_MIN)
return GDK_OSX_UNSUPPORTED;