adium 5019:89b86d3ffe84: Add autorelease pools to all AWEzvConta...

commits at adium.im commits at adium.im
Wed Sep 5 20:00:20 UTC 2012


details:	http://hg.adium.im/adium/rev/89b86d3ffe84
revision:	5019:89b86d3ffe84
branch:		adium-1.5.4
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Wed Sep 05 22:00:03 2012 +0200

Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.

diffs (124 lines):

diff -r 2a488b40cf74 -r 89b86d3ffe84 Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m
--- a/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m	Mon Aug 20 11:07:36 2012 +0200
+++ b/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m	Wed Sep 05 22:00:03 2012 +0200
@@ -805,9 +805,13 @@
 
 void register_reply(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	AWEzvContactManager *self = context;
 	[self setInstanceName:[NSString stringWithUTF8String:name]];
 	[self regCallBack:errorCode];
+	
+	[pool release];
 }
 
 void image_register_reply( 
@@ -817,12 +821,16 @@
 	DNSServiceErrorType errorCode, 
 	void *context)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	if (errorCode != kDNSServiceErr_NoError) {
 		AWEzvLog(@"error %d registering image record", errorCode);
 	} else {
 		AWEzvContactManager *self = context;
 		[self updatePHSH];
 	}
+	
+	[pool release];
 }
 
 #pragma mark mDNS Browse Callback
@@ -841,6 +849,8 @@
 							const char *replyDomain,
 							void *context)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	// Received a browser reply from DNSServiceBrowse for av, now must handle processing the list of results
 	if (errorCode == kDNSServiceErr_NoError) {
 		AWEzvContactManager *self = context;
@@ -850,6 +860,8 @@
 	} else {
 		AWEzvLog(@"Error browsing");
 	}
+	
+	[pool release];
 }
 
 #pragma mark mDNS Resolve Callback
@@ -870,6 +882,8 @@
 					const unsigned char *txtRecord, 
 					void *context)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	if (errorCode == kDNSServiceErr_NoError) {
 		// Use TXTRecord methods to resolve this
 		AWEzvContact	*contact = context;
@@ -881,7 +895,9 @@
 		[self updateContact:contact withData:data withHost:[NSString stringWithUTF8String:hosttarget] withInterface:interfaceIndex withPort:ntohs(port) av:YES];
 	} else {
 		AWEzvLog(@"Error resolving records");
-	}	
+	}
+	
+	[pool release];
 }
 
 #pragma mark mDNS Address Callback
@@ -891,12 +907,15 @@
 							uint16_t rdlen, const void *rdata, uint32_t ttl, void *context )
 // DNSServiceQueryRecord callback used to look up IP addresses.
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	AWEzvContact	*contact = context;
 	AWEzvContactManager *self = [contact manager];
 
 	[self updateAddressForContact:contact addr:rdata addrLen:rdlen host:fullname interfaceIndex:interfaceIndex
 							 more:((flags & kDNSServiceFlagsMoreComing) != 0)];
 
+	[pool release];
 }
 
 #pragma mark mDNS Image Callback
@@ -906,6 +925,8 @@
 							uint16_t rdlen, const void *rdata, uint32_t ttl, void *context)
 // DNSServiceQueryRecord callback used to look up buddy icon.
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	AWEzvContact	*contact = context;
 	AWEzvContactManager *self = [contact manager];
 	if (errorCode == kDNSServiceErr_NoError) {
@@ -913,6 +934,8 @@
 			[self updateImageForContact:contact data:rdata dataLen:rdlen more:((flags & kDNSServiceFlagsMoreComing) != 0)];
 		}
 	}
+	
+	[pool release];
 }
 
 #pragma mark Service Controller
@@ -926,6 +949,8 @@
 static void	ProcessSockData( CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
 // CFRunloop callback that notifies dns_sd when new data appears on a DNSServiceRef's socket.
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	ServiceController *self = (ServiceController *)info;
 	AILogWithSignature(@"Processing result for %@", self);
 
@@ -953,6 +978,8 @@
 			DNSServiceRefSockFD(info), err, type, data);
 		}
 	}
+	
+	[pool release];
 }
 
 - (id) initWithServiceRef:(DNSServiceRef) ref forContactManager:(AWEzvContactManager *)inContactManager




More information about the commits mailing list