1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-21 13:46:52 +00:00

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; 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) setViewController: (BlocklistDownloaderViewController *) viewController;
- (void) cancelDownload; - (void) cancelDownload;

View file

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

View file

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