From 20cdf0162a5aaf5fb16fbc8283c21ded1de8b7d4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 31 Dec 2010 01:25:03 +0000 Subject: [PATCH] #3851 use an autorelease pool when the completeness callback is called; revert the unnecessary r11607 --- macosx/Controller.m | 12 ------------ macosx/Torrent.m | 4 ++++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index aa2bafd0e..ff7420692 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1911,8 +1911,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) torrentFinishedDownloading: (NSNotification *) notification { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - Torrent * torrent = [notification object]; if ([[[notification userInfo] objectForKey: @"WasRunning"] boolValue]) @@ -1953,14 +1951,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy } [self updateTorrentsInQueue]; - - [pool drain]; } - (void) torrentRestartedDownloading: (NSNotification *) notification { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - Torrent * torrent = [notification object]; if ([torrent isActive] && [fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0) { @@ -1969,14 +1963,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy } [self updateTorrentsInQueue]; - - [pool drain]; } - (void) torrentFinishedSeeding: (NSNotification *) notification { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - Torrent * torrent = [notification object]; [self updateTorrentsInQueue]; @@ -2007,8 +1997,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title") description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE iconData: nil priority: 0 isSticky: NO clickContext: clickContext]; - - [pool drain]; } - (void) updateTorrentHistory diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 3f03689a8..161d4f3a2 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -62,9 +62,13 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, tr_bool wasRunning, void * torrentData) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status", [NSNumber numberWithBool: wasRunning], @"WasRunning", nil]; [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO]; + + [pool drain]; } void ratioLimitHitCallback(tr_torrent * torrent, void * torrentData)