1
0
Fork 0
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:
Mitchell Livingston 2013-02-11 01:47:51 +00:00
parent 196bbafadb
commit 313fe8ae94

View file

@ -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];
});
}
}