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
parent
63bd6b29d7
commit
85283b99a1
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue