Sandbox Broker: Fixed a potential reference crash

The code which looked up Sandbox handles for a given path had a bug
where it would re-add the handle to the in-memory cache storage even if
it already had just retrieved the current handle from the cache. I hope
this will fix the crashes which have been plaguing people adding a lot
of files to the playlist all at once from a single folder.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-11-29 00:49:27 -08:00
parent ecd46cfa3c
commit d7d6014789
No known key found for this signature in database
1 changed files with 4 additions and 8 deletions

View File

@ -435,16 +435,12 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
if(!_entry) {
_entry = [self recursivePathTest:folderUrl];
if(_entry)
[self->storage addObject:_entry];
}
if(_entry) {
[self->storage addObject:_entry];
if(_entry.secureUrl) {
[_entry.secureUrl startAccessingSecurityScopedResource];
}
} else {
_entry = NULL;
if(_entry && _entry.secureUrl) {
[_entry.secureUrl startAccessingSecurityScopedResource];
}
});