From 580420c28e252ff8b373b05b92fb4f83497a9e03 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 5 Nov 2024 17:40:47 +0900 Subject: [PATCH] Ensure we are not halting the entire application when trying to generate the debug archive for macOS vfs Signed-off-by: Claudio Cambra --- src/gui/macOS/fileproviderxpc.h | 2 +- src/gui/macOS/fileproviderxpc_mac.mm | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/macOS/fileproviderxpc.h b/src/gui/macOS/fileproviderxpc.h index 39bc86397..6dfbb0650 100644 --- a/src/gui/macOS/fileproviderxpc.h +++ b/src/gui/macOS/fileproviderxpc.h @@ -45,7 +45,7 @@ public slots: void configureExtensions(); void authenticateExtension(const QString &extensionAccountId) const; void unauthenticateExtension(const QString &extensionAccountId) const; - void createDebugArchiveForExtension(const QString &extensionAccountId, const QString &filename) const; + void createDebugArchiveForExtension(const QString &extensionAccountId, const QString &filename); void setFastEnumerationEnabledForExtension(const QString &extensionAccountId, bool enabled) const; diff --git a/src/gui/macOS/fileproviderxpc_mac.mm b/src/gui/macOS/fileproviderxpc_mac.mm index cc4b14a2a..60fe7c2a5 100644 --- a/src/gui/macOS/fileproviderxpc_mac.mm +++ b/src/gui/macOS/fileproviderxpc_mac.mm @@ -111,9 +111,13 @@ void FileProviderXPC::slotAccountStateChanged(const AccountState::State state) c break; } } -void FileProviderXPC::createDebugArchiveForExtension(const QString &extensionAccountId, const QString &filename) const +void FileProviderXPC::createDebugArchiveForExtension(const QString &extensionAccountId, const QString &filename) { qCInfo(lcFileProviderXPC) << "Creating debug archive for extension" << extensionAccountId << "at" << filename; + if (!fileProviderExtReachable(extensionAccountId)) { + qCWarning(lcFileProviderXPC) << "Extension is not reachable. Cannot create debug archive"; + return; + } // You need to fetch the contents from the extension and then create the archive from the client side. // The extension is not allowed to ask for permission to write into the file system as it is not a user facing process. const auto clientCommService = (NSObject *)_clientCommServices.value(extensionAccountId);