mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-23 04:45:43 +03:00
Merge pull request #6892 from nextcloud/bugfix/avoid-freeze-vfs-settings
Fix permanent freeze upon opening macOS VFS settings
This commit is contained in:
commit
ba155beee5
1 changed files with 11 additions and 1 deletions
|
@ -20,6 +20,10 @@
|
|||
#include "gui/macOS/fileproviderdomainmanager.h"
|
||||
#include "gui/macOS/fileproviderxpc_mac_utils.h"
|
||||
|
||||
namespace {
|
||||
constexpr int64_t semaphoreWaitDelta = 3000000000; // 3 seconds
|
||||
}
|
||||
|
||||
namespace OCC::Mac {
|
||||
|
||||
Q_LOGGING_CATEGORY(lcFileProviderXPC, "nextcloud.gui.macos.fileprovider.xpc", QtInfoMsg)
|
||||
|
@ -148,13 +152,19 @@ std::optional<std::pair<bool, bool>> FileProviderXPC::fastEnumerationStateForExt
|
|||
|
||||
__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_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
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}};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue