• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableArray removeObject: crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray removeObject: crash


  • Subject: Re: NSMutableArray removeObject: crash
  • From: Kevin Wojniak <email@hidden>
  • Date: Fri, 4 Apr 2008 16:30:27 -0400

On Apr 4, 2008, at 4:18 PM, Shawn Erickson wrote:
What are the exception codes for this "crash". Are you sure it is a
crash and not a report of runtime exception? (aka the notifications
object is nil)

Are you somehow over releasing the object that posts the notification
(aka the self used at time of posting the notification)?

-Shawn

It is showing up as KERN_INVALID_ADDRESS. I don't release "self" until after (not immediately) the notification is sent.




On Apr 4, 2008, at 4:21 PM, Hamish Allan wrote:
On Fri, Apr 4, 2008 at 9:08 PM, Kevin Wojniak <email@hidden> wrote:

[_array removeObject:obj];

Are you sure _array is valid and properly retained?

Hamish

I was thinking about this. However, I have looked through the code and _array doesn't get released until the class deallocs, and that doesn't happen until the app quits, and the crash isn't occurring when the app quits. But I might switch it over to using an accessor that retains/ autoreleases the object instead of accessing it directly. Would probably be safer altogether.




On Apr 4, 2008, at 4:23 PM, A.M. wrote:
You should verify that the object is valid. You could do this simply by setting a breakpoint before removeObject and printing the object description to the console. If that crashes, then the object is invalid. Then print out the _array-if that crashes, your array is invalid. In any case, try NSZombieEnabled.

Cheers,
M

Unfortunately I can't duplicate the crash myself (although with the previous replies I have a few ideas on how I could).



Kevin _______________________________________________

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


References: 
 >NSMutableArray removeObject: crash (From: Kevin Wojniak <email@hidden>)
 >Re: NSMutableArray removeObject: crash (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: Re: Main Thread UI and Detached Thread
  • Next by Date: Re: core data - beyond the simple example
  • Previous by thread: Re: NSMutableArray removeObject: crash
  • Next by thread: Re: NSMutableArray removeObject: crash
  • Index(es):
    • Date
    • Thread