Skip to content

Commit

Permalink
Add check to detect if we timed out wait for file provider extension …
Browse files Browse the repository at this point in the history
…service response on fast enumeration state

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and backportbot[bot] committed Jul 9, 2024
1 parent d10ad17 commit b8d0cf0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/macOS/fileproviderxpc_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::pair<bool, bool>>{{receivedFastEnumerationEnabled, receivedFastEnumerationSet}};
}

Expand Down

0 comments on commit b8d0cf0

Please sign in to comment.