[Playlist/Metadata] Prevent a race condition
Prevent a race condition with deleting playlist entries while their metadata is still being loaded by the player. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
9d558a89ab
commit
6c7a3e581c
|
@ -559,6 +559,8 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
progress += progressstep;
|
progress += progressstep;
|
||||||
[weakLock unlock];
|
[weakLock unlock];
|
||||||
|
|
||||||
|
if(weakPe.deleted) return;
|
||||||
|
|
||||||
DLog(@"Loading metadata for %@", weakPe.URL);
|
DLog(@"Loading metadata for %@", weakPe.URL);
|
||||||
|
|
||||||
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:weakPe.URL];
|
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:weakPe.URL];
|
||||||
|
@ -590,8 +592,10 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
__block PlaylistEntry *weakPe = [outArray objectAtIndex:i];
|
__block PlaylistEntry *weakPe = [outArray objectAtIndex:i];
|
||||||
__block NSDictionary *entryInfo = [outArray objectAtIndex:i + 1];
|
__block NSDictionary *entryInfo = [outArray objectAtIndex:i + 1];
|
||||||
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
|
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
|
||||||
|
if(!weakPe.deleted) {
|
||||||
[weakPe setMetadata:entryInfo];
|
[weakPe setMetadata:entryInfo];
|
||||||
[store trackUpdate:weakPe];
|
[store trackUpdate:weakPe];
|
||||||
|
}
|
||||||
progress += progressstep;
|
progress += progressstep;
|
||||||
[self setProgressBarStatus:progress];
|
[self setProgressBarStatus:progress];
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue