Updating the library always on the main thread prevents a race condition between multiple threads interacting with the poor, innocent core data backend.
@@ -144,7 +144,7 @@
{
/* update library now that we got a file */
VLCAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
- [appDelegate updateMediaList];
+ [appDelegate performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
if ([self.delegate respondsToSelector:@selector(operationWithProgressInformationStopped)])
[self.delegate operationWithProgressInformationStopped];
@@ -238,7 +238,7 @@
APLog(@"DriveFile download was successful");
@@ -116,7 +116,7 @@
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
APLog(@"http file download complete");
VLCAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
[self _downloadEnded];
}
@@ -159,7 +159,7 @@
/* update media library when file upload was completed */
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
@end