cancel blocklist download when quitting; cleanup

This commit is contained in:
Mitchell Livingston 2008-08-31 20:26:41 +00:00
parent 8cf84293b5
commit 3c997c92a7
3 changed files with 12 additions and 2 deletions

View File

@ -40,7 +40,9 @@
long long fExpectedSize;
}
+ (BlocklistDownloader *) downloader: (tr_handle *) handle;
+ (BlocklistDownloader *) downloader: (tr_handle *) handle; //starts download if not already occuring
+ (BOOL) isRunning;
- (void) setViewController: (BlocklistDownloaderViewController *) viewController;
- (void) cancelDownload;

View File

@ -51,6 +51,11 @@ BlocklistDownloader * fDownloader = nil;
return fDownloader;
}
+ (BOOL) isRunning
{
return fDownloader != nil;
}
- (void) setViewController: (BlocklistDownloaderViewController *) viewController
{
fViewController = viewController;

View File

@ -38,6 +38,7 @@
#import "ButtonToolbarItem.h"
#import "GroupToolbarItem.h"
#import "ToolbarSegmentedCell.h"
#import "BlocklistDownloader.h"
#import "NSApplicationAdditions.h"
#import "NSStringAdditions.h"
#import "NSMenuAdditions.h"
@ -559,7 +560,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) applicationWillTerminate: (NSNotification *) notification
{
#warning stop blocklist download
//stop blocklist download
if ([BlocklistDownloader isRunning])
[[BlocklistDownloader downloader: fLib] cancelDownload];
//stop timers and notification checking
[[NSNotificationCenter defaultCenter] removeObserver: self];