From 1fb6eaa34e8c5f15b5fc0807d8256f24b8eb38ec Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 30 Dec 2010 12:33:37 +0000 Subject: [PATCH] use autorelease pools when handling downloading/seeding state changes --- macosx/Controller.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/macosx/Controller.m b/macosx/Controller.m index ff7420692..aa2bafd0e 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1911,6 +1911,8 @@ 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]) @@ -1951,10 +1953,14 @@ 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) { @@ -1963,10 +1969,14 @@ 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]; @@ -1997,6 +2007,8 @@ 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