#3851 use an autorelease pool when the completeness callback is called; revert the unnecessary r11607

This commit is contained in:
Mitchell Livingston 2010-12-31 01:25:03 +00:00
parent a17962d5fc
commit 20cdf0162a
2 changed files with 4 additions and 12 deletions

View File

@ -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

View File

@ -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)