From 66262c2a7161b592b23703464fe51f95faee1547 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 27 Jun 2022 01:00:11 -0700 Subject: [PATCH] [Sandbox Broker] Synchronize full access operation Full access should be synchronized, otherwise rapid access to the same path from different threads will cause crashes. Signed-off-by: Christopher Snowhill --- Utils/SandboxBroker.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Utils/SandboxBroker.m b/Utils/SandboxBroker.m index 24fd720ae..b53024f65 100644 --- a/Utils/SandboxBroker.m +++ b/Utils/SandboxBroker.m @@ -266,18 +266,18 @@ static SandboxBroker *kSharedSandboxBroker = nil; if(!_entry) { _entry = [self recursivePathTest:folderUrl]; } - } - if(_entry) { - [storage addObject:_entry]; + if(_entry) { + [storage addObject:_entry]; - if(_entry.secureUrl) { - [_entry.secureUrl startAccessingSecurityScopedResource]; + if(_entry.secureUrl) { + [_entry.secureUrl startAccessingSecurityScopedResource]; + } + + return CFBridgingRetain(_entry); + } else { + return NULL; } - - return CFBridgingRetain(_entry); - } else { - return NULL; } }