• 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: runModalForWindow crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: runModalForWindow crash


  • Subject: Re: runModalForWindow crash
  • From: Jo Meder <email@hidden>
  • Date: Tue, 26 Jan 2010 14:54:03 +1300

Hi Nick,

On 26/01/2010, at 6:06 AM, Nick Zitzmann wrote:

> On Jan 24, 2010, at 6:14 PM, Jo Meder wrote:
>
>> My guess is that [NSApplication runModalForWindow:] is trying to send a message to my window object which has been released by now perhaps? I think I'm probably not getting something to do with object lifetimes here or something. Does anyone have any ideas what the problem might be?
>
> Try running your program in Instruments with the zombies instrument. Programs crash in objc_msgSend() when something sends a message to a deallocated object. The zombies instrument will catch this and show you the retain/release history of the bad object.

Thanks for the tip, very useful.

I've managed to address this problem, and a few other crashing problems when closing windows, by using performSelectorOnMainThread:withObject:waitUntilDone: with my window cleanup method as the selector. This looks to have the effect of delaying the call to the window cleanup until the current event has completed and it's safe to tear down the window etc. without pulling the rug out from under anything. I previously did a similar thing in Carbon by posting a kEventWindowClose event to the event queue.

Regards,

Jo Meder_______________________________________________

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: 
 >runModalForWindow crash (From: Jo Meder <email@hidden>)
 >Re: runModalForWindow crash (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Focus Ring and NSTextField
  • Next by Date: Re: simple file browser
  • Previous by thread: Re: runModalForWindow crash
  • Next by thread: How to hook into the Apple clock timer API?
  • Index(es):
    • Date
    • Thread