adium 5022:932796c0e3bf: Wrap a number of other callbacks in aut...
commits at adium.im
commits at adium.im
Wed Sep 5 20:58:04 UTC 2012
details: http://hg.adium.im/adium/rev/932796c0e3bf
revision: 5022:932796c0e3bf
branch: adium-1.5.4
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Wed Sep 05 22:57:49 2012 +0200
Wrap a number of other callbacks in autoreleasepools.
diffs (226 lines):
diff -r 324b6951b6c8 -r 932796c0e3bf Plugins/Purple Service/AMPurpleJabberAdHocServer.m
--- a/Plugins/Purple Service/AMPurpleJabberAdHocServer.m Wed Sep 05 22:40:54 2012 +0200
+++ b/Plugins/Purple Service/AMPurpleJabberAdHocServer.m Wed Sep 05 22:57:49 2012 +0200
@@ -27,11 +27,15 @@
@implementation AMPurpleJabberAdHocServer
static void AMPurpleJabberAdHocServer_received_data_cb(PurpleConnection *gc, xmlnode **packet, gpointer this) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
AMPurpleJabberAdHocServer *self = this;
PurpleAccount *account = [self.account purpleAccount];
if(purple_account_get_connection(account) == gc) {
- if(strcmp((*packet)->name,"iq"))
+ if(strcmp((*packet)->name,"iq")) {
+ [pool release];
return;
+ }
const char *type = xmlnode_get_attrib(*packet,"type");
if(!type || strcmp(type,"set"))
return; // doesn't talk to us, probably the user interacting with some other adhoc node
@@ -48,10 +52,13 @@
}
}
}
+
+ [pool release];
}
/* we have to catch the reply to a disco#info for http://jabber.org/protocol/commands and insert our nodes */
static void xmlnode_sent_cb(PurpleConnection *gc, xmlnode **packet, gpointer this) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
xmlnode *xml = *packet;
AMPurpleJabberAdHocServer *self = this;
PurpleAccount *account = [self.account purpleAccount];
@@ -78,6 +85,7 @@
}
}
}
+ [pool release];
}
+ (void)initialize {
diff -r 324b6951b6c8 -r 932796c0e3bf Plugins/Purple Service/AMPurpleJabberNode.m
--- a/Plugins/Purple Service/AMPurpleJabberNode.m Wed Sep 05 22:40:54 2012 +0200
+++ b/Plugins/Purple Service/AMPurpleJabberNode.m Wed Sep 05 22:57:49 2012 +0200
@@ -39,31 +39,48 @@
@implementation AMPurpleJabberNode
static void AMPurpleJabberNode_received_data_cb(PurpleConnection *gc, xmlnode **packet, gpointer this) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
AMPurpleJabberNode *self = (AMPurpleJabberNode*)this;
// we're receiving *all* packets, so let's filter out those that don't concern us
const char *from = xmlnode_get_attrib(*packet, "from");
- if (!from)
+ if (!from) {
+ [pool release];
return;
- if (!(*packet)->name)
+ }
+ if (!(*packet)->name){
+ [pool release];
return;
+ }
const char *type = xmlnode_get_attrib(*packet, "type");
- if (!type || (strcmp(type, "result") && strcmp(type, "error")))
+ if (!type || (strcmp(type, "result") && strcmp(type, "error"))){
+ [pool release];
return;
- if (strcmp((*packet)->name, "iq"))
+ }
+ if (strcmp((*packet)->name, "iq")){
+ [pool release];
return;
- if (![[NSString stringWithUTF8String:from] isEqualToString:self.jid])
+ }
+ if (![[NSString stringWithUTF8String:from] isEqualToString:self.jid]){
+ [pool release];
return;
+ }
xmlnode *query = xmlnode_get_child_with_namespace(*packet,"query","http://jabber.org/protocol/disco#info");
if (query) {
- if (self.features || self.identities)
+ if (self.features || self.identities) {
+ [pool release];
return; // we already have that information
-
+ }
const char *queryNode = xmlnode_get_attrib(query,"node");
- if ((self.node && !queryNode) || (!self.node && queryNode))
+ if ((self.node && !queryNode) || (!self.node && queryNode)){
+ [pool release];
return;
- if (queryNode && ![[NSString stringWithUTF8String:queryNode] isEqualToString:self.node])
+ }
+ if (queryNode && ![[NSString stringWithUTF8String:queryNode] isEqualToString:self.node]){
+ [pool release];
return;
+ }
// it's us, fill in features and identities
NSMutableArray *identities = [NSMutableArray array];
@@ -117,19 +134,26 @@
[self.commandsNode fetchItems];
}
}
+ [pool release];
return;
}
query = xmlnode_get_child_with_namespace(*packet,"query","http://jabber.org/protocol/disco#items");
if (query) {
- if (self.itemsArray)
+ if (self.itemsArray) {
+ [pool release];
return; // we already have that info
+ }
const char *checkNode = xmlnode_get_attrib(query,"node");
- if ((self.node && !checkNode) || (!self.node && checkNode))
+ if ((self.node && !checkNode) || (!self.node && checkNode)) {
+ [pool release];
return;
- if (checkNode && ![[NSString stringWithUTF8String:checkNode] isEqualToString:self.node])
+ }
+ if (checkNode && ![[NSString stringWithUTF8String:checkNode] isEqualToString:self.node]){
+ [pool release];
return;
+ }
// it's us, create the subnodes
NSMutableArray *newItems = [NSMutableArray array];
@@ -174,6 +198,8 @@
[delegate jabberNodeGotItems:self];
}
}
+
+ [pool release];
}
- (id)initWithJID:(NSString*)_jid node:(NSString*)_node name:(NSString*)_name connection:(PurpleConnection*)_gc {
diff -r 324b6951b6c8 -r 932796c0e3bf Plugins/Purple Service/AMXMLConsoleController.m
--- a/Plugins/Purple Service/AMXMLConsoleController.m Wed Sep 05 22:40:54 2012 +0200
+++ b/Plugins/Purple Service/AMXMLConsoleController.m Wed Sep 05 22:57:49 2012 +0200
@@ -28,10 +28,14 @@
static void
xmlnode_received_cb(PurpleConnection *gc, xmlnode **packet, gpointer this)
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
AMXMLConsoleController *self = (AMXMLConsoleController *)this;
- if (!this || [self gc] != gc)
- return;
+ if (!this || [self gc] != gc) {
+ [pool release];
+ return;
+ }
char *str = xmlnode_to_formatted_str(*packet, NULL);
NSString *sstr = [NSString stringWithUTF8String:str];
@@ -45,23 +49,30 @@
[astr release];
g_free(str);
+
+ [pool release];
}
static void
xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer this)
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
AMXMLConsoleController *self = (AMXMLConsoleController *)this;
xmlnode *node;
- if (!this || [self gc] != gc)
- return;
+ if (!this || [self gc] != gc) {
+ [pool release];
+ return;
+ }
node = ((*packet && strlen(*packet) && ((*packet)[0] == '<')) ?
xmlnode_from_str(*packet, -1) :
NULL);
- if (!node)
+ if (!node) {
+ [pool release];
return;
+ }
char *str = xmlnode_to_formatted_str(node, NULL);
NSString *sstr = [NSString stringWithUTF8String:str];
@@ -76,6 +87,8 @@
g_free(str);
xmlnode_free(node);
+
+ [pool release];
}
@implementation AMXMLConsoleController
diff -r 324b6951b6c8 -r 932796c0e3bf Plugins/Purple Service/adiumPurpleDnsRequest.m
--- a/Plugins/Purple Service/adiumPurpleDnsRequest.m Wed Sep 05 22:40:54 2012 +0200
+++ b/Plugins/Purple Service/adiumPurpleDnsRequest.m Wed Sep 05 22:57:49 2012 +0200
@@ -102,6 +102,8 @@
const CFStreamError *streamError,
void *info)
{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
AdiumPurpleDnsRequest *self = (AdiumPurpleDnsRequest *)info;
if (streamError && (streamError->error != 0)) {
[self lookupFailedWithError:streamError];
@@ -119,6 +121,8 @@
[self lookupFailedWithError:NULL];
}
}
+
+ [pool release];
}
/*!
More information about the commits
mailing list