Serialize persistent store update to main thread

This needs to be called on the main thread, as something may or may not
be enumerating over the data while this thread decides to call it.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2022-06-22 19:11:06 -07:00
parent 6867ef1e9a
commit b2c354a32c

View file

@ -751,7 +751,9 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
}); });
} }
[playlistController commitPersistentStore]; dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
[self->playlistController commitPersistentStore];
});
[playlistController performSelectorOnMainThread:@selector(updateTotalTime) withObject:nil waitUntilDone:NO]; [playlistController performSelectorOnMainThread:@selector(updateTotalTime) withObject:nil waitUntilDone:NO];