stop timers and notification checking on quit right away (real this time)

This commit is contained in:
Mitchell Livingston 2007-11-02 03:15:12 +00:00
parent 4cb7eb603d
commit 59fb0f936f
1 changed files with 12 additions and 13 deletions

View File

@ -528,6 +528,18 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (void) applicationWillTerminate: (NSNotification *) notification
{
//stop timers and notification checking
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fTimer invalidate];
[fSpeedLimitTimer invalidate];
if (fAutoImportTimer)
{
if ([fAutoImportTimer isValid])
[fAutoImportTimer invalidate];
[fAutoImportTimer release];
}
//remove all torrent downloads
if (fPendingTorrentDownloads)
{
@ -553,16 +565,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fTempTorrentFiles removeAllObjects];
}
//stop timers
[fTimer invalidate];
[fSpeedLimitTimer invalidate];
if (fAutoImportTimer)
{
if ([fAutoImportTimer isValid])
[fAutoImportTimer invalidate];
[fAutoImportTimer release];
}
//remember window states and close all windows
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
@ -595,9 +597,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
while ([startDate timeIntervalSinceNow] >= -5.0 && tr_handleStatus(fLib)->natTraversalStatus != TR_NAT_TRAVERSAL_DISABLED)
usleep(100000);
//remaining calls the same as dealloc
[[NSNotificationCenter defaultCenter] removeObserver: self];
[fInfoController release];
[fMessageController release];
[fPrefsController release];