Changeset 3691


Ignore:
Timestamp:
Nov 2, 2007, 3:15:35 AM (14 years ago)
Author:
livings124
Message:

0.9x: stop timers and notification checking on quit right away

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9x/macosx/Controller.m

    r3688 r3691  
    522522- (void) applicationWillTerminate: (NSNotification *) notification
    523523{
    524     //remove all torrent downloads
    525     if (fPendingTorrentDownloads)
    526     {
    527         NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
    528         NSDictionary * downloadDict;
    529         NSURLDownload * download;
    530         while ((downloadDict = [downloadEnumerator nextObject]))
    531         {
    532             download = [downloadDict objectForKey: @"Download"];
    533             [download cancel];
    534             [download release];
    535         }
    536         [fPendingTorrentDownloads removeAllObjects];
    537     }
    538    
    539     //remove all remaining torrent files in the temporary directory
    540     if (fTempTorrentFiles)
    541     {
    542         NSEnumerator * torrentEnumerator = [fTempTorrentFiles objectEnumerator];
    543         NSString * path;
    544         while ((path = [torrentEnumerator nextObject]))
    545             [[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
    546         [fTempTorrentFiles removeAllObjects];
    547     }
    548    
    549     //stop timers
     524    //stop timers and notification checking
     525    [[NSNotificationCenter defaultCenter] removeObserver: self];
     526   
    550527    [fTimer invalidate];
    551528    [fSpeedLimitTimer invalidate];
     
    557534    }
    558535   
     536    //remove all torrent downloads
     537    if (fPendingTorrentDownloads)
     538    {
     539        NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
     540        NSDictionary * downloadDict;
     541        NSURLDownload * download;
     542        while ((downloadDict = [downloadEnumerator nextObject]))
     543        {
     544            download = [downloadDict objectForKey: @"Download"];
     545            [download cancel];
     546            [download release];
     547        }
     548        [fPendingTorrentDownloads removeAllObjects];
     549    }
     550   
     551    //remove all remaining torrent files in the temporary directory
     552    if (fTempTorrentFiles)
     553    {
     554        NSEnumerator * torrentEnumerator = [fTempTorrentFiles objectEnumerator];
     555        NSString * path;
     556        while ((path = [torrentEnumerator nextObject]))
     557            [[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
     558        [fTempTorrentFiles removeAllObjects];
     559    }
     560   
    559561    //remember window states and close all windows
    560562    [fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
     
    588590   
    589591    //remaining calls the same as dealloc
    590     [[NSNotificationCenter defaultCenter] removeObserver: self];
    591    
    592592    [fInfoController release];
    593593    [fMessageController release];
Note: See TracChangeset for help on using the changeset viewer.