From 953b1035320c94de60c23a52b61f6d9c8599fe54 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 9 Jul 2024 14:48:47 +0800 Subject: [PATCH] Add check to detect if we timed out wait for file provider extension service response on fast enumeration state Signed-off-by: Claudio Cambra --- src/gui/macOS/fileproviderxpc_mac.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/macOS/fileproviderxpc_mac.mm b/src/gui/macOS/fileproviderxpc_mac.mm index 5db62867fb139..cc0b7b4679230 100644 --- a/src/gui/macOS/fileproviderxpc_mac.mm +++ b/src/gui/macOS/fileproviderxpc_mac.mm @@ -152,13 +152,19 @@ __block BOOL receivedFastEnumerationEnabled; // What is the value of the setting being used by the extension? __block BOOL receivedFastEnumerationSet; // Has the setting been set by the user? + __block BOOL receivedResponse = NO; dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); [service getFastEnumerationStateWithCompletionHandler:^(BOOL enabled, BOOL set) { receivedFastEnumerationEnabled = enabled; receivedFastEnumerationSet = set; + receivedResponse = YES; dispatch_semaphore_signal(semaphore); }]; dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, semaphoreWaitDelta)); + if (!receivedResponse) { + qCWarning(lcFileProviderXPC) << "Did not receive response for fast enumeration state"; + return std::nullopt; + } return std::optional>{{receivedFastEnumerationEnabled, receivedFastEnumerationSet}}; }