[SOLVED] Re: death in dealloc
[SOLVED] Re: death in dealloc
- Subject: [SOLVED] Re: death in dealloc
- From: Stuart Malin <email@hidden>
- Date: Sun, 14 Mar 2010 08:59:43 -0400
Spot on, Steven. My memory management was faulty. My object had been instantiating another object via alloc that it kept a reference to in an iVar, and my (outer) object released that instantiated (inner) object in its -dealloc method. I refactored the code, and changed the way I acquire the (inner) object to use a class factory method, which returned an autoreleased instance. Of course, with this change, the reference to the (inner) object should no longer be held by an iVar, and so I have now changed that as well.
On Mar 13, 2010, at 4:46 PM, Steven Degutis wrote:
> This is almost always caused by releasing an object earlier than you expected to, and then trying to release it again later (similar to "double free"). Look around in your class's code for a place where you autorelease an ivar, but don't add it to a collection, or where you release an ivar but don't set it to nil afterwards.
>
> -Steven
>
> On Sat, Mar 13, 2010 at 12:53 PM, Stuart Malin <email@hidden> wrote:
> I have some code that is throwing EXC_BAD_ACCESS. It does so when an object is deallocating, in its -dealloc method on a call to [super dealloc]. The object's class's superclass is NSObject. Here's the (relevant part of the) stack trace:
>
> #0 0x7fff872e016d in _class_hasCxxStructorsNoSuper
> #1 0x7fff872e0741 in object_cxxDestructFromClass
> #2 0x7fff872e60f8 in objc_destructInstance
> #3 0x7fff872e06f5 in _internal_object_dispose
> #4 0x7fff83e0279a in -[NSObject(NSObject) dealloc]
> #5 0x10007b18e in -[ZPOauthParams dealloc] at ZPOauthParams.m:57
>
> I know I must have blown something, but I have no idea what I could have done to cause this sort of problem. If anyone has seen something like this before, please let me in what direction I should look for the problem. TIA.
>
_______________________________________________
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