Commit be49a677 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Robustify media library updating

Updating the library always on the main thread prevents a race condition between multiple threads interacting with the poor, innocent core data backend.
parent 68a4b708
......@@ -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 @@
/* update library now that we got a file */
APLog(@"DriveFile download was successful");
VLCAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate updateMediaList];
[appDelegate performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
if ([self.delegate respondsToSelector:@selector(operationWithProgressInformationStopped)])
[self.delegate operationWithProgressInformationStopped];
......
......@@ -116,7 +116,7 @@
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {
APLog(@"http file download complete");
VLCAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate updateMediaList];
[appDelegate performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
[self _downloadEnded];
}
......
......@@ -159,7 +159,7 @@
/* update media library when file upload was completed */
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate updateMediaList];
[appDelegate performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment