Skip navigation.
 
mlRe: EXC_BAD_ACCESS when trying to use [NSMutableURLRequest setHTTPBodyStream]
FROM : Dave Carrigan
DATE : Thu Jan 10 18:29:14 2008

On Jan 10, 2008, at 8:52 AM, I. Savant wrote:

>> I've had this suggestion from a few people, so I'm going to report
>> back to the list that the unretained objects is not the cause of my
>> problem. I changed my code to look like:

>
>  Is the "Uploader" object that contains this code retained as well?
> You set it as the delegate of your NSURLConnection. Is it still around
> when the NSURLConnection instance you create makes calls back to your
> Uploader instance?


Yes it is, because it's not autorelease. It's alloced with [[Uploader 
alloc] initWithURL] and I never do a dealloc on it. (But just to be 
sure, I just added a retain there, with no change in the crash.)

>  The error you're reporting *is* memory-management-related.


Yes, that seems reasonable, but the more I think about it, the more I 
think it must be a bug in the library.  Based on the stack trace, it 
seems like it's a problem with the NSInputStream object, but I even 
tried doing

  NSInputStream* stream = [[[NSInputStream ....] retain] retain] 
retain]

to try and workaround it if something is doing an extra release, but I 
still get the same crash.

--
Dave Carrigan
<email_removed>
Seattle, WA, USA