diff options
Diffstat (limited to 'src/corelib/kernel/qcore_mac.mm')
-rw-r--r-- | src/corelib/kernel/qcore_mac.mm | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm index b18a7d56ef..9b5a073993 100644 --- a/src/corelib/kernel/qcore_mac.mm +++ b/src/corelib/kernel/qcore_mac.mm @@ -255,16 +255,9 @@ QMacAutoReleasePool::QMacAutoReleasePool() #ifdef QT_DEBUG void *poolFrame = nullptr; - if (__builtin_available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)) { - void *frame; - if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1)) - poolFrame = frame; - } else { - static const int maxFrames = 3; - void *callstack[maxFrames]; - if (backtrace(callstack, maxFrames) == maxFrames) - poolFrame = callstack[maxFrames - 1]; - } + void *frame; + if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1)) + poolFrame = frame; if (poolFrame) { Dl_info info; @@ -335,14 +328,9 @@ QDebug operator<<(QDebug debug, const QCFString &string) #ifdef Q_OS_MACOS bool qt_mac_applicationIsInDarkMode() { -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) - if (__builtin_available(macOS 10.14, *)) { - auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames: - @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]]; - return [appearance isEqualToString:NSAppearanceNameDarkAqua]; - } -#endif - return false; + auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames: + @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]]; + return [appearance isEqualToString:NSAppearanceNameDarkAqua]; } bool qt_mac_runningUnderRosetta() @@ -426,8 +414,7 @@ void qt_mac_ensureResponsible() CHECK_SPAWN(posix_spawnattr_setflags(&attr, flags)); - if (@available(macOS 10.14, *)) - CHECK_SPAWN(responsibility_spawnattrs_setdisclaim(&attr, 1)); + CHECK_SPAWN(responsibility_spawnattrs_setdisclaim(&attr, 1)); char **argv = *_NSGetArgv(); posix_spawnp(&pid, argv[0], nullptr, &attr, argv, environ); @@ -562,10 +549,18 @@ void qt_apple_check_os_version() const char *os = "macOS"; const int version = __MAC_OS_X_VERSION_MIN_REQUIRED; #endif - const NSOperatingSystemVersion required = (NSOperatingSystemVersion){ - version / 10000, version / 100 % 100, version % 100}; - const NSOperatingSystemVersion current = NSProcessInfo.processInfo.operatingSystemVersion; - if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:required]) { + + const auto required = QVersionNumber(version / 10000, version / 100 % 100, version % 100); + const auto current = QOperatingSystemVersion::current().version(); + +#if defined(Q_OS_MACOS) + // Check for compatibility version, in which case we can't do a + // comparison to the deployment target, which might be e.g. 11.0 + if (current.majorVersion() == 10 && current.minorVersion() >= 16) + return; +#endif + + if (current < required) { NSDictionary *plist = NSBundle.mainBundle.infoDictionary; NSString *applicationName = plist[@"CFBundleDisplayName"]; if (!applicationName) @@ -576,8 +571,8 @@ void qt_apple_check_os_version() fprintf(stderr, "Sorry, \"%s\" cannot be run on this version of %s. " "Qt requires %s %ld.%ld.%ld or later, you have %s %ld.%ld.%ld.\n", applicationName.UTF8String, os, - os, long(required.majorVersion), long(required.minorVersion), long(required.patchVersion), - os, long(current.majorVersion), long(current.minorVersion), long(current.patchVersion)); + os, long(required.majorVersion()), long(required.minorVersion()), long(required.microVersion()), + os, long(current.majorVersion()), long(current.minorVersion()), long(current.microVersion())); exit(1); } @@ -711,11 +706,9 @@ QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machH || loadCommand->cmd == LC_VERSION_MIN_TVOS || loadCommand->cmd == LC_VERSION_MIN_WATCHOS) { auto versionCommand = reinterpret_cast<version_min_command *>(loadCommand); return makeVersionTuple(versionCommand->version, versionCommand->sdk, osForLoadCommand(loadCommand->cmd)); -#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0) } else if (loadCommand->cmd == LC_BUILD_VERSION) { auto versionCommand = reinterpret_cast<build_version_command *>(loadCommand); return makeVersionTuple(versionCommand->minos, versionCommand->sdk, osForPlatform(versionCommand->platform)); -#endif } commandCursor += loadCommand->cmdsize; } |