(trunk) fix a problem when adding multiple torrents with "always ask" enabled

This commit is contained in:
Mitchell Livingston
2007-08-15 22:30:54 +00:00
parent 455ce8b185
commit 4bccdef1fd
2 changed files with 8 additions and 6 deletions

View File

@@ -817,7 +817,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
tr_info_t info;
while ([files count] > 0)
{
torrentPath = [files objectAtIndex: 0];
torrentPath = [[files objectAtIndex: 0] retain];
canAdd = tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info);
if (canAdd == TR_OK)
break;
@@ -836,8 +836,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[self updateTorrentHistory];
return;
}
[files removeObjectAtIndex: 0];
NSOpenPanel * panel = [NSOpenPanel openPanel];
[panel setPrompt: NSLocalizedString(@"Select", "Open torrent -> prompt")];
@@ -848,11 +849,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the download folder for \"%@\"",
"Open torrent -> select destination folder"), [NSString stringWithUTF8String: info.name]]];
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: [torrentPath retain], @"Path",
files, @"Files", [NSNumber numberWithInt: deleteTorrent], @"DeleteTorrent", nil];
tr_metainfoFree(&info);
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: torrentPath, @"Path",
files, @"Files", [NSNumber numberWithInt: deleteTorrent], @"DeleteTorrent", nil];
[torrentPath release];
[panel beginSheetForDirectory: nil file: nil types: nil modalForWindow: fWindow modalDelegate: self
didEndSelector: @selector(folderChoiceClosed:returnCode:contextInfo:) contextInfo: dictionary];
}