[SOLVED] Re: Help with NSURLConnection memory fault
[SOLVED] Re: Help with NSURLConnection memory fault
- Subject: [SOLVED] Re: Help with NSURLConnection memory fault
- From: Stuart Malin <email@hidden>
- Date: Wed, 14 Oct 2009 22:43:20 -0400
On Oct 14, 2009, at 7:24 PM, Jens Alfke wrote:
It looks as though your object (the delegate) got dealloced too
early, before the NSURLConnection finished loading. This shouldn't
be possible, since the connection object retains the delegate, but
you may have too many release calls to it someplace.
What I would do next is set a breakpoint in your class's dealloc
method, and also in its -connectionDidFinishLoading: and -
connection:didFailWithError:, and see which gets called first.
Thanks for the reply, Jens. As I suspected, the time sequence
ordering of the releases was just fine. The problem was releasing the
NSURLConnection object twice, once when the connection had concluded,
and again when the object that had created it was dealloc'ing (because
I hadn't nil'd the pointer to the connection object after releasing
it). Just a "lucky" coincidence that the memory where the dealloc'd
NSURLConnection had lived was still the (now defunct) object, so it
went through its motions again, and tried to release the delegate a
second time.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden