Changeset 3691 for branches/0.9x/macosx/Controller.m
- Timestamp:
- Nov 2, 2007, 3:15:35 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9x/macosx/Controller.m
r3688 r3691 522 522 - (void) applicationWillTerminate: (NSNotification *) notification 523 523 { 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 550 527 [fTimer invalidate]; 551 528 [fSpeedLimitTimer invalidate]; … … 557 534 } 558 535 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 559 561 //remember window states and close all windows 560 562 [fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"]; … … 588 590 589 591 //remaining calls the same as dealloc 590 [[NSNotificationCenter defaultCenter] removeObserver: self];591 592 592 [fInfoController release]; 593 593 [fMessageController release];
Note: See TracChangeset
for help on using the changeset viewer.