Ignore:
Timestamp:
Feb 11, 2012, 5:13:46 AM (10 years ago)
Author:
livings124
Message:

replace NSAutoreleasePool objects with @autoreleasepool blocks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BlocklistDownloader.m

    r13162 r13219  
    237237- (void) finishDownloadSuccess
    238238{
    239     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    240    
    241     [fViewController setStatusProcessing];
    242    
    243     //process data
    244     NSAssert(fDestination != nil, @"the blocklist file destination has not been specified");
    245    
    246     [self decompressBlocklist];
    247    
    248     const int count = tr_blocklistSetContent([PrefsController handle], [fDestination UTF8String]);
    249    
    250     //delete downloaded file
    251     [[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
    252    
    253     if (count > 0)
    254         [fViewController setFinished];
    255     else
    256         [fViewController setFailed: NSLocalizedString(@"The specified blocklist file did not contain any valid rules.",
    257                                         "blocklist fail message")];
    258    
    259     //update last updated date for schedule
    260     NSDate * date = [NSDate date];
    261     [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdate"];
    262     [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdateSuccess"];
    263     [[BlocklistScheduler scheduler] updateSchedule];
    264    
    265     [[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil];
    266    
    267     [pool drain];
     239    @autoreleasepool
     240    {
     241        [fViewController setStatusProcessing];
     242       
     243        //process data
     244        NSAssert(fDestination != nil, @"the blocklist file destination has not been specified");
     245       
     246        [self decompressBlocklist];
     247       
     248        const int count = tr_blocklistSetContent([PrefsController handle], [fDestination UTF8String]);
     249       
     250        //delete downloaded file
     251        [[NSFileManager defaultManager] removeItemAtPath: fDestination error: NULL];
     252       
     253        if (count > 0)
     254            [fViewController setFinished];
     255        else
     256            [fViewController setFailed: NSLocalizedString(@"The specified blocklist file did not contain any valid rules.",
     257                                            "blocklist fail message")];
     258       
     259        //update last updated date for schedule
     260        NSDate * date = [NSDate date];
     261        [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdate"];
     262        [[NSUserDefaults standardUserDefaults] setObject: date forKey: @"BlocklistNewLastUpdateSuccess"];
     263        [[BlocklistScheduler scheduler] updateSchedule];
     264       
     265        [[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil];
     266    }
    268267   
    269268    fDownloader = nil;
Note: See TracChangeset for help on using the changeset viewer.