Changeset 13492


Ignore:
Timestamp:
Sep 10, 2012, 2:37:29 AM (9 years ago)
Author:
livings124
Message:

properly retain/release nstimers like any other objective-c object

Location:
trunk/macosx
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/AddWindowController.m

    r13434 r13492  
    134134    }
    135135   
    136     fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self
    137                 selector: @selector(updateFiles) userInfo: nil repeats: YES];
     136    fTimer = [[NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self
     137                selector: @selector(updateFiles) userInfo: nil repeats: YES] retain];
    138138    [self updateFiles];
    139139}
     
    151151   
    152152    [fTimer invalidate];
     153    [fTimer release];
    153154   
    154155    [fDestination release];
     
    221222{
    222223    [fTimer invalidate];
     224    [fTimer release];
    223225    fTimer = nil;
    224226   
     
    332334{
    333335    [fTimer invalidate];
     336    [fTimer release];
    334337    fTimer = nil;
    335338    [fTorrent setGroupValue: fGroupValue];
  • trunk/macosx/BlocklistScheduler.m

    r13162 r13492  
    7070    NSDate * useDate = lastUpdateDate ? [lastUpdateDate laterDate: closeDate] : closeDate;
    7171   
    72     fTimer = [[NSTimer alloc] initWithFireDate: useDate interval: 0 target: self selector: @selector(runUpdater)
    73                 userInfo: nil repeats: NO];
     72    fTimer = [[NSTimer alloc] initWithFireDate: useDate interval: 0 target: self selector: @selector(runUpdater) userInfo: nil repeats: NO];
    7473   
    7574    //current run loop usually means a second update won't work
     
    8382{
    8483    [fTimer invalidate];
     84    [fTimer release];
    8585    fTimer = nil;
    8686}
     
    9292- (void) runUpdater
    9393{
     94    [fTimer release];
    9495    fTimer = nil;
    9596    [BlocklistDownloader downloader];
  • trunk/macosx/Controller.m

    r13491 r13492  
    538538    //timer to update the interface every second
    539539    [self updateUI];
    540     fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
    541                 selector: @selector(updateUI) userInfo: nil repeats: YES];
     540    fTimer = [[NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
     541                selector: @selector(updateUI) userInfo: nil repeats: YES] retain];
    542542    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSModalPanelRunLoopMode];
    543543    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
     
    683683   
    684684    [fTimer invalidate];
     685    [fTimer release];
    685686   
    686687    if (fAutoImportTimer)
  • trunk/macosx/CreatorWindowController.m

    r13396 r13492  
    207207   
    208208    [fTimer invalidate];
     209    [fTimer release];
    209210   
    210211    [super dealloc];
     
    552553    tr_free(trackerInfo);
    553554   
    554     fTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(checkProgress)
    555                 userInfo: nil repeats: YES];
     555    fTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(checkProgress) userInfo: nil repeats: YES] retain];
    556556}
    557557
     
    561561    {
    562562        [fTimer invalidate];
     563        [fTimer release];
    563564        fTimer = nil;
    564565       
  • trunk/macosx/MessageWindowController.m

    r13471 r13492  
    140140   
    141141    [fTimer invalidate];
     142    [fTimer release];
    142143    [fLock release];
    143144   
     
    154155    if (!fTimer)
    155156    {
    156         fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES];
     157        fTimer = [[NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES] retain];
    157158        [self updateLog: nil];
    158159    }
     
    162163{
    163164    [fTimer invalidate];
     165    [fTimer release];
    164166    fTimer = nil;
    165167}
     
    176178{
    177179    [fTimer invalidate];
    178     fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES];
     180    [fTimer release];
     181    fTimer = [[NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateLog:) userInfo: nil repeats: YES] retain];
    179182    [self updateLog: nil];
    180183}
  • trunk/macosx/PortChecker.m

    r13434 r13492  
    4646        fStatus = PORT_STATUS_CHECKING;
    4747       
    48         fTimer = [NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self selector: @selector(startProbe:)
    49                     userInfo: [NSNumber numberWithInteger: portNumber] repeats: NO];
     48        fTimer = [[NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self selector: @selector(startProbe:) userInfo: [NSNumber numberWithInteger: portNumber] repeats: NO] retain];
    5049        if (!delay)
    5150            [fTimer fire];
     
    5857{
    5958    [fTimer invalidate];
     59    [fTimer release];
    6060   
    6161    [fConnection release];
     
    7272{
    7373    [fTimer invalidate];
     74    [fTimer release];
    7475    fTimer = nil;
    7576   
     
    125126- (void) startProbe: (NSTimer *) timer
    126127{
     128    [fTimer release];
    127129    fTimer = nil;
    128130   
  • trunk/macosx/PrefsController.m

    r13491 r13492  
    147147   
    148148    [fPortStatusTimer invalidate];
     149    [fPortStatusTimer release];
    149150    if (fPortChecker)
    150151    {
     
    202203   
    203204    [self updatePortStatus];
    204     fPortStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self
    205                         selector: @selector(updatePortStatus) userInfo: nil repeats: YES];
     205    fPortStatusTimer = [[NSTimer scheduledTimerWithTimeInterval: 5.0 target: self selector: @selector(updatePortStatus) userInfo: nil repeats: YES] retain];
    206206   
    207207    //set peer connections
  • trunk/macosx/StatsWindowController.m

    r13412 r13492  
    6464    [self updateStats];
    6565   
    66     fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateStats) userInfo: nil repeats: YES];
     66    fTimer = [[NSTimer scheduledTimerWithTimeInterval: UPDATE_SECONDS target: self selector: @selector(updateStats) userInfo: nil repeats: YES] retain];
    6767    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSModalPanelRunLoopMode];
    6868    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
     
    134134{
    135135    [fTimer invalidate];
     136    [fTimer release];
     137    fTimer = nil;
    136138   
    137139    [fStatsWindowInstance autorelease];
Note: See TracChangeset for help on using the changeset viewer.