mirror of
https://github.com/transmission/transmission
synced 2025-02-25 15:32:33 +00:00
replace NSAutoreleasePool objects with @autoreleasepool blocks
This commit is contained in:
parent
72b0086cef
commit
34d9663139
4 changed files with 129 additions and 136 deletions
|
@ -236,8 +236,8 @@ BlocklistDownloader * fDownloader = nil;
|
|||
|
||||
- (void) finishDownloadSuccess
|
||||
{
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
[fViewController setStatusProcessing];
|
||||
|
||||
//process data
|
||||
|
@ -263,8 +263,7 @@ BlocklistDownloader * fDownloader = nil;
|
|||
[[BlocklistScheduler scheduler] updateSchedule];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"BlocklistUpdated" object: nil];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
fDownloader = nil;
|
||||
[self release];
|
||||
|
|
|
@ -4430,8 +4430,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
- (void) rpcCallback: (tr_rpc_callback_type) type forTorrentStruct: (struct tr_torrent *) torrentStruct
|
||||
{
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
//get the torrent
|
||||
Torrent * torrent = nil;
|
||||
if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED && type != TR_RPC_SESSION_CLOSE))
|
||||
|
@ -4445,8 +4445,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
if (!torrent)
|
||||
{
|
||||
[pool drain];
|
||||
|
||||
NSLog(@"No torrent found matching the given torrent struct from the RPC callback!");
|
||||
return;
|
||||
}
|
||||
|
@ -4497,8 +4495,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
NSAssert1(NO, @"Unknown RPC command received: %d", type);
|
||||
[torrent release];
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) rpcAddTorrentStruct: (NSValue *) torrentStructPtr
|
||||
|
|
|
@ -67,13 +67,12 @@ void startQueueCallback(tr_torrent * torrent, void * torrentData)
|
|||
|
||||
void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, bool wasRunning, void * torrentData)
|
||||
{
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
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)
|
||||
|
@ -93,12 +92,11 @@ void metadataCallback(tr_torrent * torrent, void * torrentData)
|
|||
|
||||
int trashDataFile(const char * filename)
|
||||
{
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
if (filename != NULL)
|
||||
[Torrent trashFile: [NSString stringWithUTF8String: filename]];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,8 +218,8 @@ NSMutableSet * fTrackerIconLoading;
|
|||
#warning better favicon detection
|
||||
- (void) loadTrackerIcon: (NSString *) baseAddress
|
||||
{
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
//try favicon.png
|
||||
NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.png"]];
|
||||
|
||||
|
@ -250,8 +250,7 @@ NSMutableSet * fTrackerIconLoading;
|
|||
[fTrackerIconCache setObject: [NSNull null] forKey: baseAddress];
|
||||
|
||||
[fTrackerIconLoading removeObject: baseAddress];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSRect) imageRectForBounds: (NSRect) bounds
|
||||
|
|
Loading…
Reference in a new issue