From e81aa64280e9835121769085023034e919274745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 28 Mar 2023 14:48:06 +0200 Subject: macOS: Move application sandbox checking to secondary thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use the macOS Security framework to check whether the application is sandboxed or not, in which case we might have to limit or change some of the functionality of Qt, such as which shared memory backend to use. Calls to SecStaticCodeCheckValidityWithErrors should ideally not be done on the main thread, as the function may not return immediately, and we get runtime analysis warnings about this in Xcode: This method should not be called on the main thread as it may lead to UI unresponsiveness. To improve the situation we spin up a short lived thread at library load that resolves the sandboxing state, ready to be queried when needed from Qt. Pick-to: 6.5 Change-Id: I52cdc1bf6aef05c3b93b43f67b3fb46035996b3a Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim --- src/corelib/kernel/qcore_mac_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qcore_mac_p.h') diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index aee5fcb604..39ffe831bb 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -195,15 +195,18 @@ Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QCFString &string); #endif Q_CORE_EXPORT bool qt_apple_isApplicationExtension(); + +#if !defined(QT_BOOTSTRAPPED) Q_CORE_EXPORT bool qt_apple_isSandboxed(); -#if !defined(QT_BOOTSTRAPPED) && defined(__OBJC__) +#if defined(__OBJC__) QT_END_NAMESPACE @interface NSObject (QtSandboxHelpers) - (id)qt_valueForPrivateKey:(NSString *)key; @end QT_BEGIN_NAMESPACE #endif +#endif // !QT_BOOTSTRAPPED #if !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WATCHOS) QT_END_NAMESPACE -- cgit v1.2.3