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/TrackerCell.m

    r13162 r13219  
    219219- (void) loadTrackerIcon: (NSString *) baseAddress
    220220{
    221     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    222    
    223     //try favicon.png
    224     NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.png"]];
    225    
    226     NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
    227                                 timeoutInterval: 30.0];
    228     NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
    229     NSImage * icon = [[NSImage alloc] initWithData: iconData];
    230    
    231     //try favicon.ico
    232     if (!icon)
     221    @autoreleasepool
    233222    {
    234         favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]];
    235        
    236         request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
    237                     timeoutInterval: 30.0];
    238         iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
    239         icon = [[NSImage alloc] initWithData: iconData];
     223        //try favicon.png
     224        NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.png"]];
     225       
     226        NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
     227                                    timeoutInterval: 30.0];
     228        NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
     229        NSImage * icon = [[NSImage alloc] initWithData: iconData];
     230       
     231        //try favicon.ico
     232        if (!icon)
     233        {
     234            favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]];
     235           
     236            request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
     237                        timeoutInterval: 30.0];
     238            iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
     239            icon = [[NSImage alloc] initWithData: iconData];
     240        }
     241       
     242        if (icon)
     243        {
     244            [fTrackerIconCache setObject: icon forKey: baseAddress];
     245            [icon release];
     246           
     247            [[self controlView] setNeedsDisplay: YES];
     248        }
     249        else
     250            [fTrackerIconCache setObject: [NSNull null] forKey: baseAddress];
     251       
     252        [fTrackerIconLoading removeObject: baseAddress];
    240253    }
    241    
    242     if (icon)
    243     {
    244         [fTrackerIconCache setObject: icon forKey: baseAddress];
    245         [icon release];
    246        
    247         [[self controlView] setNeedsDisplay: YES];
    248     }
    249     else
    250         [fTrackerIconCache setObject: [NSNull null] forKey: baseAddress];
    251    
    252     [fTrackerIconLoading removeObject: baseAddress];
    253 
    254     [pool drain];
    255254}
    256255
Note: See TracChangeset for help on using the changeset viewer.