Ben Copsey

When ASINetworkQueues are dealloced, they should set the *queue* property to nil…

…, not the *delegate* property
Add cancelledLock around queue setter
@@ -373,6 +373,12 @@ static BOOL isiPhoneOS2; @@ -373,6 +373,12 @@ static BOOL isiPhoneOS2;
373 [[self cancelledLock] unlock]; 373 [[self cancelledLock] unlock];
374 } 374 }
375 375
  376 +- (void)setQueue:(id)newQueue
  377 +{
  378 + [[self cancelledLock] lock];
  379 + queue = newQueue;
  380 + [[self cancelledLock] unlock];
  381 +}
376 382
377 #pragma mark get information about this request 383 #pragma mark get information about this request
378 384
@@ -20,8 +20,6 @@ @@ -20,8 +20,6 @@
20 20
21 @implementation ASINetworkQueue 21 @implementation ASINetworkQueue
22 22
23 -@synthesize userInfo;  
24 -  
25 - (id)init 23 - (id)init
26 { 24 {
27 self = [super init]; 25 self = [super init];
@@ -39,9 +37,9 @@ @@ -39,9 +37,9 @@
39 37
40 - (void)dealloc 38 - (void)dealloc
41 { 39 {
42 - //We need to clear the delegate on any requests that haven't got around to cleaning up yet, as otherwise they'll try to let us know if something goes wrong, and we'll be long gone by then 40 + //We need to clear the queue on any requests that haven't got around to cleaning up yet, as otherwise they'll try to let us know if something goes wrong, and we'll be long gone by then
43 for (ASIHTTPRequest *request in [self operations]) { 41 for (ASIHTTPRequest *request in [self operations]) {
44 - [request setDelegate:nil]; 42 + [request setQueue:nil];
45 } 43 }
46 [userInfo release]; 44 [userInfo release];
47 [super dealloc]; 45 [super dealloc];
@@ -330,5 +328,6 @@ @@ -330,5 +328,6 @@
330 @synthesize queueDidFinishSelector; 328 @synthesize queueDidFinishSelector;
331 @synthesize delegate; 329 @synthesize delegate;
332 @synthesize showAccurateProgress; 330 @synthesize showAccurateProgress;
  331 +@synthesize userInfo;
333 332
334 @end 333 @end