1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

Fix hang in CSBackupSetItemExcluded (#4208)

This commit is contained in:
A Cœur 2022-11-19 22:50:13 +08:00 committed by GitHub
parent d27c4c59ce
commit 292b092f54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,7 @@ static int const kETAIdleDisplaySec = 2 * 60;
@property(nonatomic) BOOL fResumeOnWake;
@property(nonatomic) BOOL fTimeMachineExcludeInitialized;
@property(nonatomic) dispatch_queue_t timeMachineExcludeQueue;
- (void)renameFinished:(BOOL)success
nodes:(NSArray<FileListNode*>*)nodes
@ -253,12 +253,6 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
coalesceMask:NSNotificationCoalescingOnName
forModes:nil];
}
//when the torrent is first loaded, update the time machine exclusion
if (!self.fTimeMachineExcludeInitialized)
{
[self updateTimeMachineExclude];
}
}
- (void)startTransferIgnoringQueue:(BOOL)ignoreQueue
@ -1773,8 +1767,9 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
name:@"GroupValueRemoved"
object:nil];
_fTimeMachineExcludeInitialized = NO;
_timeMachineExcludeQueue = dispatch_queue_create("updateTimeMachineExclude", DISPATCH_QUEUE_CONCURRENT);
[self update];
[self updateTimeMachineExclude];
return self;
}
@ -2113,8 +2108,10 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error** error)
NSString* path;
if ((path = self.dataLocation))
{
CSBackupSetItemExcluded((__bridge CFURLRef)[NSURL fileURLWithPath:path], exclude, false);
self.fTimeMachineExcludeInitialized = YES;
dispatch_async(_timeMachineExcludeQueue, ^{
CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:path];
CSBackupSetItemExcluded(url, exclude, false);
});
}
}