From 4bccdef1fd55b8d048898579e2f5d2ecfef86076 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 15 Aug 2007 22:30:54 +0000 Subject: [PATCH] (trunk) fix a problem when adding multiple torrents with "always ask" enabled --- Transmission.xcodeproj/project.pbxproj | 2 +- macosx/Controller.m | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index ff144eef3..92ee40f12 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -331,7 +331,7 @@ 4DFBC2DD09C0970D00D5C571 /* Torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Torrent.h; path = macosx/Torrent.h; sourceTree = ""; }; 4DFBC2DE09C0970D00D5C571 /* Torrent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Torrent.m; path = macosx/Torrent.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Info.plist; path = macosx/Info.plist; sourceTree = ""; }; - 8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; }; A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = ""; }; A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = ""; }; A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = ""; }; diff --git a/macosx/Controller.m b/macosx/Controller.m index abf8a8257..86a6546f9 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -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]; }