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:
parent
d27c4c59ce
commit
292b092f54
1 changed files with 7 additions and 10 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue