{
NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
NSDictionary * downloadDict;
- NSURLDownload * download;
while ((downloadDict = [downloadEnumerator nextObject]))
{
- download = [downloadDict objectForKey: @"Download"];
+ NSURLDownload * download = [downloadDict objectForKey: @"Download"];
[download cancel];
[download release];
}
[fPendingTorrentDownloads removeAllObjects];
}
- //remove all remaining torrent files in the temporary directory
- if (fTempTorrentFiles)
- {
- NSEnumerator * torrentEnumerator = [fTempTorrentFiles objectEnumerator];
- NSString * path;
- while ((path = [torrentEnumerator nextObject]))
- [[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
- }
-
//remember window states and close all windows
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
[fAutoImportedNames release];
[fPendingTorrentDownloads release];
- [fTempTorrentFiles release];
//complete cleanup
tr_sessionClose(fLib);
[error localizedDescription]], NSLocalizedString(@"OK", "Torrent download failed -> button"), nil, nil);
[fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
+ if ([fPendingTorrentDownloads count] == 0)
+ {
+ [fPendingTorrentDownloads release];
+ fPendingTorrentDownloads = nil;
+ }
+
[download release];
}
[self openFiles: [NSArray arrayWithObject: path] addType: ADD_URL forcePath: nil];
+ [[NSFileManager defaultManager] removeFileAtPath: path handler: nil]; //delete the torrent file after opening
+
[fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
- [download release];
+ if ([fPendingTorrentDownloads count] == 0)
+ {
+ [fPendingTorrentDownloads release];
+ fPendingTorrentDownloads = nil;
+ }
- //delete temp torrent file on quit
- if (!fTempTorrentFiles)
- fTempTorrentFiles = [[NSMutableArray alloc] init];
- [fTempTorrentFiles addObject: path];
+ [download release];
}
- (void) application: (NSApplication *) app openFiles: (NSArray *) filenames