On Apr 2, 2015, at 10:56 AM, Dave <d...@looktowindward.com> wrote:

> I’m getting a crash in dealloc in an NSWindow Subclass.

> If I run this, then I get a crash when the autorelease pool is drained. 
> However, if I take out the line:
> 
> [super close];
> 
> in my close method, all works fine.
> 
> Is this expected?

If you have a window which is not being controlled by a window controller and 
whose releasedWhenClosed property is true (default for NSWindow), then it will 
be released when it is closed (unsurprisingly).  Therefore, you should not 
release it again yourself or you will over-release it and cause a crash (or 
worse).

The easiest thing to do is to always turn off releasedWhenClosed so that window 
objects obey normal memory management conventions.

Regards,
Ken


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to