mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
perform the rename callback in the main thread
This commit is contained in:
parent
196bbafadb
commit
313fe8ae94
1 changed files with 6 additions and 5 deletions
|
@ -94,14 +94,15 @@ void metadataCallback(tr_torrent * torrent, void * torrentData)
|
|||
|
||||
void renameCallback(tr_torrent * torrent, const char * oldPathCharString, const char * newNameCharString, int error, void * contextInfo)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSString * oldPath = [NSString stringWithUTF8String: oldPathCharString];
|
||||
NSString * newName = [NSString stringWithUTF8String: newNameCharString];
|
||||
|
||||
NSDictionary * contextDict = [(NSDictionary *)contextInfo autorelease];
|
||||
Torrent * torrentObject = [contextDict objectForKey: @"Torrent"];
|
||||
[torrentObject renameFinished: error == 0 withNodes: [contextDict objectForKey: @"Nodes"] completionHandler: [contextDict objectForKey: @"CompletionHandler"] oldPath: oldPath newName: newName];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSDictionary * contextDict = [(NSDictionary *)contextInfo autorelease];
|
||||
Torrent * torrentObject = [contextDict objectForKey: @"Torrent"];
|
||||
[torrentObject renameFinished: error == 0 withNodes: [contextDict objectForKey: @"Nodes"] completionHandler: [contextDict objectForKey: @"CompletionHandler"] oldPath: oldPath newName: newName];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue