From d62674e81debb235d6f3a36669923bb5c5c0e63f Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Tue, 25 Aug 2015 11:35:30 +0200 Subject: [PATCH] Avoid run-time warnings for OS X version checks under 10.10+. Implement workaround in UMAGetSystemVersion() function which produced the following warning on the console for every application launch on OS X 10.10+: WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.5 instead of 10.10.5. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.* Workaround for 3.0 branch instead of correct implementation in commit 658eca28961d79afd2dca23524410c8dd6f183fc --- src/osx/core/utilsexc_base.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osx/core/utilsexc_base.cpp b/src/osx/core/utilsexc_base.cpp index f510abc37a..2329ee9370 100644 --- a/src/osx/core/utilsexc_base.cpp +++ b/src/osx/core/utilsexc_base.cpp @@ -62,7 +62,16 @@ long UMAGetSystemVersion() static SInt32 sUMASystemVersion = 0 ; if ( sUMASystemVersion == 0 ) { - verify_noerr(Gestalt(gestaltSystemVersion, &sUMASystemVersion)); + // gestaltSystemVersion is deprecated since 10.8 and produces a runtime + // warning since 10.10 and will always return 0x109z. (z = micro version) + // As a workaround to the runtime warning return the hard coded value + // to supress the operating system warning. + int majorCur, minorCur; + wxGetOsVersion(&majorCur, &minorCur); + if ( majorCur > 10 || (majorCur == 10 && minorCur >= 10) ) + sUMASystemVersion = 0x1090; + else + verify_noerr(Gestalt(gestaltSystemVersion, &sUMASystemVersion)); } return sUMASystemVersion ; }