mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
get rid of a crash when canceling the open sheet
This commit is contained in:
parent
3cfbb199af
commit
57bc23edc5
5 changed files with 31 additions and 18 deletions
|
@ -48,6 +48,8 @@
|
|||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
|
||||
deleteTorrent: (torrentFileState) deleteTorrent;
|
||||
|
||||
- (Torrent *) torrent;
|
||||
|
||||
- (void) setDestination: (id) sender;
|
||||
|
||||
- (void) add: (id) sender;
|
||||
|
|
|
@ -124,6 +124,11 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (Torrent *) torrent
|
||||
{
|
||||
return fTorrent;
|
||||
}
|
||||
|
||||
- (void) setDestination: (id) sender
|
||||
{
|
||||
NSOpenPanel * panel = [NSOpenPanel openPanel];
|
||||
|
@ -146,20 +151,15 @@
|
|||
[fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
|
||||
[fTorrent setGroupValue: [[fGroupPopUp selectedItem] tag]];
|
||||
|
||||
[fController askOpenConfirmed: fTorrent];
|
||||
[fController askOpenConfirmed: self add: YES];
|
||||
|
||||
if ([fDeleteCheck state] == NSOnState)
|
||||
[fTorrent trashTorrent];
|
||||
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void) cancelAdd: (id) sender
|
||||
{
|
||||
[fTorrent closeRemoveTorrent];
|
||||
[fTorrent release];
|
||||
|
||||
[self release];
|
||||
[fController askOpenConfirmed: self add: NO];
|
||||
}
|
||||
|
||||
- (void) updateGroupMenu: (NSNotification *) notification
|
||||
|
@ -200,9 +200,8 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
#warning crashes here
|
||||
if (!fDestination)
|
||||
[self cancelAdd: nil];
|
||||
[self performSelectorOnMainThread: @selector(cancelAdd:) withObject: nil waitUntilDone: NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#import "PrefsController.h"
|
||||
#import "InfoWindowController.h"
|
||||
#import "MessageWindowController.h"
|
||||
#import "AddWindowController.h"
|
||||
#import "DragOverlayWindow.h"
|
||||
#import "Badger.h"
|
||||
#import "StatusBarView.h"
|
||||
|
@ -118,7 +119,7 @@ typedef enum
|
|||
|
||||
- (void) openFiles: (NSArray *) filenames;
|
||||
- (void) openFiles: (NSArray *) filenames addType: (addType) type forcePath: (NSString *) path;
|
||||
- (void) askOpenConfirmed: (Torrent *) torrent;
|
||||
- (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add;
|
||||
- (void) openCreatedFile: (NSNotification *) notification;
|
||||
- (void) openFilesWithDict: (NSDictionary *) dictionary;
|
||||
- (void) openShowSheet: (id) sender;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#import "TorrentTableView.h"
|
||||
#import "CreatorWindowController.h"
|
||||
#import "StatsWindowController.h"
|
||||
#import "AddWindowController.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "AboutWindowController.h"
|
||||
#import "ButtonToolbarItem.h"
|
||||
|
@ -797,7 +796,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
[self updateTorrentsInQueue];
|
||||
}
|
||||
|
||||
- (void) askOpenConfirmed: (Torrent *) torrent
|
||||
- (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add
|
||||
{
|
||||
[addController close];
|
||||
|
||||
Torrent * torrent = [addController torrent];
|
||||
if (add)
|
||||
{
|
||||
[torrent setOrderValue: [fTorrents count]-1]; //ensure that queue order is always sequential
|
||||
|
||||
|
@ -807,6 +811,14 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
[self updateTorrentsInQueue];
|
||||
}
|
||||
else
|
||||
{
|
||||
[torrent closeRemoveTorrent];
|
||||
[torrent release];
|
||||
}
|
||||
|
||||
[addController release];
|
||||
}
|
||||
|
||||
- (void) openCreatedFile: (NSNotification *) notification
|
||||
{
|
||||
|
|
|
@ -1485,7 +1485,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if (fPublicTorrent)
|
||||
fPublicTorrentLocation = [path retain];
|
||||
|
||||
#warning can it be nil? -- doesn't need the default value, since it'll be passed in
|
||||
fDownloadFolder = downloadFolder ? downloadFolder : [fDefaults stringForKey: @"DownloadFolder"];
|
||||
fDownloadFolder = [[fDownloadFolder stringByExpandingTildeInPath] retain];
|
||||
|
||||
|
|
Loading…
Reference in a new issue