Don't make other actions rely on dealloc being called...it's not reliable. This should make quitting faster in many instances.

This commit is contained in:
Mitchell Livingston
2007-07-01 05:23:07 +00:00
parent 6962fa6bc9
commit 6ebb14f416
5 changed files with 27 additions and 16 deletions
-1
View File
@@ -112,7 +112,6 @@ Michael Demars <keul@m0k.org>
Rashid Eissing
+ Transfers preferences icon
+ Interface conceptualization
Deanna Phillips
+ Manpage for transmissioncli
+17 -9
View File
@@ -161,8 +161,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
{
fLib = tr_init("macosx");
fTorrents = [[NSMutableArray alloc] init];
fDisplayedTorrents = [[NSMutableArray alloc] init];
fTorrents = [[[NSMutableArray alloc] init] retain];
fDisplayedTorrents = [[[NSMutableArray alloc] init] retain];
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
fDefaults = [NSUserDefaults standardUserDefaults];
@@ -178,7 +178,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
fRemoteQuit = NO;
[GrowlApplicationBridge setGrowlDelegate: self];
[[UKKQueue sharedFileWatcher] setDelegate: self];
}
return self;
@@ -193,8 +192,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fPrefsController release];
[fToolbar release];
[fTorrents release];
[fDisplayedTorrents release];
[fBadger release];
if (fOverlayWindow)
[fOverlayWindow release];
@@ -297,9 +298,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//old version saved transfer info in prefs file
if (!history)
{
if ((history = [fDefaults arrayForKey: @"History"]))
[history retain];
[fDefaults removeObjectForKey: @"History"];
[fDefaults removeObjectForKey: @"History"];
}
if (history)
{
@@ -370,7 +373,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
currentFilterButton = fNoFilterButton;
}
[currentFilterButton setEnabled: YES];
//observe notifications
@@ -431,8 +434,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[self applyFilter: nil];
[fWindow makeKeyAndOrderFront: nil];
if ([fDefaults boolForKey: @"InfoVisible"])
[self showInfo: nil];
@@ -544,6 +545,13 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//save history and stop running torrents
[self updateTorrentHistory];
//make sure torrent is closed
enumerator = [fTorrents objectEnumerator];
Torrent * torrent;
while ((torrent = [enumerator nextObject]))
[torrent closeTorrent];
[fDisplayedTorrents removeAllObjects];
[fTorrents removeAllObjects];
@@ -1147,7 +1155,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if (!lowestOrderValue || [lowestOrderValue compare: currentOrderValue] == NSOrderedDescending)
lowestOrderValue = currentOrderValue;
[torrent removeTorrent];
[torrent closeRemoveTorrent];
[fTorrents removeObject: torrent];
[fDisplayedTorrents removeObject: torrent];
}
@@ -1700,12 +1708,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
NSMutableArray * tempTorrents = [[NSMutableArray alloc] initWithCapacity: [fTorrents count]];
NSString * filterType = [fDefaults stringForKey: @"Filter"];
BOOL filtering = ![filterType isEqualToString: @"None"];
int downloading = 0, seeding = 0, paused = 0;
BOOL isDownloading = [filterType isEqualToString: @"Download"],
isSeeding = [filterType isEqualToString: @"Seed"],
isPaused = [filterType isEqualToString: @"Pause"];
BOOL filtering = isDownloading || isSeeding || isPaused;
//get count of each type
NSEnumerator * enumerator = [fTorrents objectEnumerator];
-1
View File
@@ -117,7 +117,6 @@ Michael Demars <keul@m0k.org>\
\
Rashid Eissing\
+ Transfers preferences icon\
+ Interface conceptualization\
\
Deanna Phillips\
+ Manpage for transmissioncli\
+2 -1
View File
@@ -75,7 +75,8 @@
- (NSDictionary *) history;
- (void) removeTorrent;
- (void) closeTorrent;
- (void) closeRemoveTorrent;
- (void) changeIncompleteDownloadFolder: (NSString *) folder;
- (void) changeDownloadFolder: (NSString *) folder;
+8 -4
View File
@@ -192,10 +192,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) dealloc
{
# warning cleanup
if (fHandle)
{
tr_torrentClose(fHandle);
if (fDownloadFolder)
[fDownloadFolder release];
if (fIncompleteFolder)
@@ -231,9 +230,15 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[super dealloc];
}
- (void) removeTorrent
- (void) closeTorrent
{
tr_torrentClose(fHandle);
}
- (void) closeRemoveTorrent
{
tr_torrentRemoveSaved(fHandle);
[self closeTorrent];
}
- (void) changeIncompleteDownloadFolder: (NSString *) folder
@@ -1497,7 +1502,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fIncompleteFolder = [[fIncompleteFolder stringByExpandingTildeInPath] retain];
}
#warning duplicate warning?
NSString * currentDownloadFolder;
tr_info_t info;
int error;