move url update to main thread to prevent core animation mutation errors (???)

This commit is contained in:
Kelvin Sherlock 2021-06-17 13:25:39 -04:00
parent 5fbc00e375
commit 23afbd8952
1 changed files with 5 additions and 19 deletions

View File

@ -386,9 +386,6 @@ enum {
[_taskIndex removeAllObjects]; [_taskIndex removeAllObjects];
[self setCurrentCount: 0]; [self setCurrentCount: 0];
[self setActive: NO]; [self setActive: NO];
//[_tableView reloadData];
//[_tableView setNeedsDisplay: YES]; // doesn't work...
} }
- (IBAction)downloadMissing:(id)sender { - (IBAction)downloadMissing:(id)sender {
@ -405,7 +402,6 @@ enum {
if (delta) { if (delta) {
[self setActive: YES]; [self setActive: YES];
//[_tableView reloadData];
} }
} }
- (IBAction)showRomFolder:(id)sender { - (IBAction)showRomFolder:(id)sender {
@ -458,14 +454,12 @@ enum {
[self downloadItem: item]; [self downloadItem: item];
[self setActive: YES]; [self setActive: YES];
//[self redrawRow: [item index]];
} }
- (IBAction)cancel:(id)sender { - (IBAction)cancel:(id)sender {
DownloadItem *item = [self clickedItem]; DownloadItem *item = [self clickedItem];
if (!item) return; if (!item) return;
[item cancelDownload]; [item cancelDownload];
//[self redrawRow: [item index]];
} }
// binding screws up with placeholder. // binding screws up with placeholder.
@ -492,8 +486,7 @@ enum {
NSUInteger tag = [sender tag]; NSUInteger tag = [sender tag];
[sender setState: NSControlStateValueOn]; [sender setState: NSControlStateValueOn];
for (NSButton *b in _filterButtons) { for (NSButton *b in _filterButtons) {
if (b != sender) [b setState: NSControlStateValueOff]; if (b != sender) [b setState: NSControlStateValueOff];
} }
@ -561,9 +554,6 @@ static NSInteger TaskStatusCode(NSURLSessionTask *task) {
if (item) { if (item) {
[item completeWithError: error]; [item completeWithError: error];
//NSUInteger row = [item index];
//[self redrawRow: row];
} }
}); });
@ -587,16 +577,12 @@ static NSInteger TaskStatusCode(NSURLSessionTask *task) {
[fm moveItemAtURL: location toURL: dest error: &error]; [fm moveItemAtURL: location toURL: dest error: &error];
DownloadItem *item = [_taskIndex objectForKey: task];
[item setLocalURL: dest];
/*
dispatch_async(dispatch_get_main_queue(), ^(void){ dispatch_async(dispatch_get_main_queue(), ^(void){
NSMutableDictionary *taskIndex = self->_taskIndex;
DownloadItem *item = [taskIndex objectForKey: task];
[item setLocalURL: dest]; [item setLocalURL: dest];
} });
*/
NSLog(@"%@", src); NSLog(@"%@", src);
} }