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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com