Changeset 14017


Ignore:
Timestamp:
Feb 11, 2013, 1:47:51 AM (8 years ago)
Author:
livings124
Message:

perform the rename callback in the main thread

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r14016 r14017  
    9595void renameCallback(tr_torrent * torrent, const char * oldPathCharString, const char * newNameCharString, int error, void * contextInfo)
    9696{
    97     @autoreleasepool
    98     {
     97    @autoreleasepool {
    9998        NSString * oldPath = [NSString stringWithUTF8String: oldPathCharString];
    10099        NSString * newName = [NSString stringWithUTF8String: newNameCharString];
    101100       
    102         NSDictionary * contextDict = [(NSDictionary *)contextInfo autorelease];
    103         Torrent * torrentObject = [contextDict objectForKey: @"Torrent"];
    104         [torrentObject renameFinished: error == 0 withNodes: [contextDict objectForKey: @"Nodes"] completionHandler: [contextDict objectForKey: @"CompletionHandler"] oldPath: oldPath newName: newName];
     101        dispatch_async(dispatch_get_main_queue(), ^{
     102            NSDictionary * contextDict = [(NSDictionary *)contextInfo autorelease];
     103            Torrent * torrentObject = [contextDict objectForKey: @"Torrent"];
     104            [torrentObject renameFinished: error == 0 withNodes: [contextDict objectForKey: @"Nodes"] completionHandler: [contextDict objectForKey: @"CompletionHandler"] oldPath: oldPath newName: newName];
     105        });
    105106    }
    106107}
Note: See TracChangeset for help on using the changeset viewer.