Ignore:
Timestamp:
Nov 1, 2012, 3:21:35 AM (9 years ago)
Author:
livings124
Message:

some cleanup to retains when removing torrents

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13607 r13608  
    13801380- (void) removeTorrents: (NSArray *) torrents deleteData: (BOOL) deleteData
    13811381{
    1382     [torrents retain];
    1383 
    13841382    if ([fDefaults boolForKey: @"CheckRemove"])
    13851383    {
     
    13951393        if ([fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0)
    13961394        {
    1397             NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
    1398                                     torrents, @"Torrents",
    1399                                     [NSNumber numberWithBool: deleteData], @"DeleteData", nil];
     1395            NSDictionary * dict = @{ @"Torrents" : torrents,
     1396                                    @"DeleteData" : @(deleteData) };
    14001397           
    14011398            NSString * title, * message;
     
    14431440            NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"),
    14441441                NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
    1445                 nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, @"%@", message);
     1442                nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), [dict retain], @"%@", message);
    14461443            return;
    14471444        }
     
    14551452    NSArray * torrents = [dict objectForKey: @"Torrents"];
    14561453    if (returnCode == NSAlertDefaultReturn)
    1457         [self confirmRemoveTorrents: [torrents retain] deleteData: [[dict objectForKey: @"DeleteData"] boolValue]];
    1458    
    1459     [torrents release];
     1454        [self confirmRemoveTorrents: torrents deleteData: [[dict objectForKey: @"DeleteData"] boolValue]];
    14601455    [dict release];
    14611456}
     
    15471542   
    15481543    [self fullUpdateUI];
    1549    
    1550     #warning why do we need them retained?
    1551     [torrents autorelease];
    15521544}
    15531545
     
    15641556- (void) clearCompleted: (id) sender
    15651557{
    1566     NSMutableArray * torrents = [[NSMutableArray alloc] init];
     1558    NSMutableArray * torrents = [NSMutableArray array];
    15671559   
    15681560    for (Torrent * torrent in fTorrents)
     
    16041596       
    16051597        if (returnCode != NSAlertFirstButtonReturn)
    1606         {
    1607             [torrents release];
    16081598            return;
    1609         }
    16101599    }
    16111600   
     
    20482037- (void) torrentFinishedSeeding: (NSNotification *) notification
    20492038{
    2050     Torrent * torrent = [[notification object] retain];
     2039    Torrent * torrent = [notification object];
    20512040   
    20522041    if (!fSoundPlaying && [fDefaults boolForKey: @"PlaySeedingSound"])
     
    20932082    //removing from the list calls fullUpdateUI
    20942083    if ([torrent removeWhenFinishSeeding])
    2095         [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO];
     2084        [self confirmRemoveTorrents: @[ torrent ] deleteData: NO];
    20962085    else
    20972086    {
     
    21072096        }
    21082097    }
    2109    
    2110     [torrent release];
    21112098}
    21122099
     
    48064793- (void) rpcRemoveTorrent: (Torrent *) torrent
    48074794{
    4808     [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: NO];
     4795    [self confirmRemoveTorrents: @[ torrent ] deleteData: NO];
    48094796    [torrent release];
    48104797}
     
    48124799- (void) rpcRemoveTorrentDeleteData: (Torrent *) torrent
    48134800{
    4814     [self confirmRemoveTorrents: [[NSArray arrayWithObject: torrent] retain] deleteData: YES];
     4801    [self confirmRemoveTorrents: @[ torrent ] deleteData: YES];
    48154802    [torrent release];
    48164803}
Note: See TracChangeset for help on using the changeset viewer.