adium 2358:7981f03cce51: There's a crash somewhere in here that ...

commits at adium.im commits at adium.im
Thu May 28 04:20:20 UTC 2009


details:	http://hg.adium.im/adium/rev/7981f03cce51
revision:	2358:7981f03cce51
author:		Zachary West <zacw at adium.im>
date:		Thu May 28 00:20:01 2009 -0400

There's a crash somewhere in here that I'm completely incapable of finding and fixing. nil everything when releasing, copy the data before parsing.

diffstat:

 Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m |  10 ++-
 Plugins/Image Uploading Plugin/AIPicImImageUploader.h            |   1 +
 Plugins/Image Uploading Plugin/AIPicImImageUploader.m            |  33 ++++++----
 3 files changed, 27 insertions(+), 17 deletions(-)

diffs (113 lines):

diff -r 6de580243c77 -r 7981f03cce51 Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m
--- a/Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m	Wed May 27 20:12:14 2009 -0700
+++ b/Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m	Thu May 28 00:20:01 2009 -0400
@@ -72,10 +72,10 @@
 
 - (void)dealloc
 {
-	[url release];
-	[headers release];
-	[uploadData release];
-	[returnedData release];
+	[url release]; url = nil;
+	[headers release]; headers = nil;
+	[uploadData release]; uploadData = nil;
+	[returnedData release]; returnedData = nil;
 	
 	[super dealloc];
 }
@@ -291,6 +291,8 @@
  */
 - (void)uploadSucceeded
 {
+	NSLog(@"Calling success");
+	
 	stream = NULL;
 	
 	[periodicTimer invalidate]; periodicTimer = nil;
diff -r 6de580243c77 -r 7981f03cce51 Plugins/Image Uploading Plugin/AIPicImImageUploader.h
--- a/Plugins/Image Uploading Plugin/AIPicImImageUploader.h	Wed May 27 20:12:14 2009 -0700
+++ b/Plugins/Image Uploading Plugin/AIPicImImageUploader.h	Thu May 28 00:20:01 2009 -0400
@@ -17,6 +17,7 @@
 	
 	AIProgressDataUploader		*dataUploader;
 	
+	NSData						*resultData;
 	NSXMLParser					*responseParser;
 	
 	// Parsing
diff -r 6de580243c77 -r 7981f03cce51 Plugins/Image Uploading Plugin/AIPicImImageUploader.m
--- a/Plugins/Image Uploading Plugin/AIPicImImageUploader.m	Wed May 27 20:12:14 2009 -0700
+++ b/Plugins/Image Uploading Plugin/AIPicImImageUploader.m	Thu May 28 00:20:01 2009 -0400
@@ -20,6 +20,7 @@
 		   uploader:(AIImageUploaderPlugin *)inUploader
 			   chat:(AIChat *)inChat;
 - (void)uploadImage;
+- (void)parseResponse:(NSData *)data;
 - (void)finishResponse;
 @end
 
@@ -51,9 +52,11 @@
 
 - (void)dealloc
 {
-	[response release];
-	[responseParser release];
-	[image release];
+	[dataUploader release]; dataUploader = nil;
+	[resultData release]; resultData = nil;
+	[response release]; response = nil;
+	[responseParser release]; responseParser = nil;
+	[image release]; image = nil;
 	
 	[super dealloc];
 }
@@ -67,23 +70,18 @@
 - (void)uploadCompleted:(id)context result:(NSData *)result
 {
 	if (result.length) {
-		response = [[NSMutableDictionary alloc] init];
-		
-		responseParser = [[NSXMLParser alloc] initWithData:result];
-		
-		[dataUploader release]; dataUploader = nil;
-		
-		[responseParser setDelegate:self];
-		[responseParser parse];
+		[self parseResponse:result];
 	} else {
 		[uploader errorWithMessage:AILocalizedString(@"Unable to upload", nil) forChat:chat];
 	}
+	
+	[dataUploader release]; dataUploader = nil;
 }
 
 - (void)uploadFailed:(id)context
 {
 	[uploader errorWithMessage:AILocalizedString(@"Unable to upload", nil) forChat:chat];
-	[dataUploader release];
+	[dataUploader release]; dataUploader = nil;
 }
 
 #pragma mark Image upload
@@ -128,10 +126,19 @@
 - (void)cancel
 {
 	[dataUploader cancel];
-	[dataUploader release];
+	[dataUploader release]; dataUploader = nil;
 }
 
 #pragma mark Response parsing
+- (void)parseResponse:(NSData *)data
+{
+	response = [[NSMutableDictionary alloc] init];
+	resultData = [data copy];
+	
+	responseParser = [[NSXMLParser alloc] initWithData:resultData];
+	[responseParser setDelegate:self];
+	[responseParser parse];
+}
 
 - (void)parserDidStartDocument:(NSXMLParser *)parser
 {




More information about the commits mailing list