mirror of
https://github.com/transmission/transmission
synced 2025-02-03 21:12:05 +00:00
better retain/release/invalidate the auto-import timer
This commit is contained in:
parent
39abb8d80e
commit
32048e7417
1 changed files with 7 additions and 13 deletions
|
@ -504,9 +504,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
[fPendingTorrentDownloads removeAllObjects];
|
[fPendingTorrentDownloads removeAllObjects];
|
||||||
|
|
||||||
//stop timers
|
//stop timers
|
||||||
[fSpeedLimitTimer invalidate];
|
|
||||||
[fTimer invalidate];
|
[fTimer invalidate];
|
||||||
if (fAutoImportTimer)
|
[fSpeedLimitTimer invalidate];
|
||||||
|
if (fAutoImportTimer && [fAutoImportTimer isValid])
|
||||||
[fAutoImportTimer invalidate];
|
[fAutoImportTimer invalidate];
|
||||||
|
|
||||||
//save history and stop running torrents
|
//save history and stop running torrents
|
||||||
|
@ -1841,26 +1841,20 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (![fDefaults boolForKey: @"AutoImport"])
|
if (![fDefaults boolForKey: @"AutoImport"])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fAutoImportTimer)
|
if (fAutoImportTimer && [fAutoImportTimer isValid])
|
||||||
{
|
|
||||||
[fAutoImportTimer invalidate];
|
[fAutoImportTimer invalidate];
|
||||||
fAutoImportTimer = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check again in 10 seconds in case torrent file wasn't complete
|
//check again in 10 seconds in case torrent file wasn't complete
|
||||||
fAutoImportTimer = [NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
|
fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
|
||||||
selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO];
|
selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
|
||||||
|
|
||||||
[self checkAutoImportDirectory];
|
[self checkAutoImportDirectory];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) changeAutoImport
|
- (void) changeAutoImport
|
||||||
{
|
{
|
||||||
if (fAutoImportTimer)
|
if (fAutoImportTimer && [fAutoImportTimer isValid])
|
||||||
{
|
|
||||||
[fAutoImportTimer invalidate];
|
[fAutoImportTimer invalidate];
|
||||||
fAutoImportTimer = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
[fAutoImportedNames removeAllObjects];
|
[fAutoImportedNames removeAllObjects];
|
||||||
[self checkAutoImportDirectory];
|
[self checkAutoImportDirectory];
|
||||||
|
@ -1870,7 +1864,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
{
|
{
|
||||||
if (![fDefaults boolForKey: @"AutoImport"])
|
if (![fDefaults boolForKey: @"AutoImport"])
|
||||||
return;
|
return;
|
||||||
|
NSLog(@"checking");
|
||||||
NSString * path = [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath];
|
NSString * path = [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath];
|
||||||
|
|
||||||
NSArray * importedNames;
|
NSArray * importedNames;
|
||||||
|
|
Loading…
Reference in a new issue