Sandbox: Fixed another outstanding sync bug

Releasing sandbox access was incorrectly synchronizing on the object,
but still running code in the calling thread. It has been updated to
match the rest of the interface, which serializes all access through the
main thread only. This should prevent the sandbox from carrying stale
handles to already-released objects.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-12-03 22:13:14 -08:00
parent 63bd6b29d7
commit 85283b99a1
No known key found for this signature in database
1 changed files with 3 additions and 4 deletions

View File

@ -455,10 +455,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
SandboxEntry *entry = CFBridgingRelease(handle);
if(!entry) return;
@synchronized(self) {
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
if(entry.refCount > 1) {
entry.refCount -= 1;
return;
} else {
if(entry.secureUrl) {
[entry.secureUrl stopAccessingSecurityScopedResource];
@ -466,9 +465,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
}
entry.refCount = 0;
[storage removeObject:entry];
[self->storage removeObject:entry];
}
}
});
}
- (BOOL)areAllPathsSafe:(NSArray *)urls {