From fc1549c01445bb9c99d3ba6de8fa9da230614e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Oct 2023 10:56:05 +0200 Subject: [PATCH] macOS: Silence warning about supporting secure state restoration We don't support or implement state restorations via the AppKit state restoration APIs, but if we did, we would/should support secure state restoration. This is the default for apps linked against the macOS 14 SDK, but as we target versions below that as well we need to return YES here explicitly to silence a runtime warning. Pick-to: 6.6 6.5 6.2 Fixes: QTBUG-117745 Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b Reviewed-by: Timur Pocheptsov --- .../cocoa/qcocoaapplicationdelegate.mm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index bb7b5c3c0c..42c76e38e8 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -329,6 +329,23 @@ QT_USE_NAMESPACE else QWindowSystemInterface::handleFileOpenEvent(qurlString); } + +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)application +{ + if (@available(macOS 12, *)) { + if ([reflectionDelegate respondsToSelector:_cmd]) + return [reflectionDelegate applicationSupportsSecureRestorableState:application]; + } + + // We don't support or implement state restorations via the AppKit + // state restoration APIs, but if we did, we would/should support + // secure state restoration. This is the default for apps linked + // against the macOS 14 SDK, but as we target versions below that + // as well we need to return YES here explicitly to silence a runtime + // warning. + return YES; +} + @end @implementation QCocoaApplicationDelegate (Menus)