Re: crash on custom NSWindow subclass dealloc
Re: crash on custom NSWindow subclass dealloc
- Subject: Re: crash on custom NSWindow subclass dealloc
- From: "Wesley Smith" <email@hidden>
- Date: Wed, 19 Dec 2007 01:52:24 -0800
Well, I solved my problem by using the windowWillClose notification.
I was thinking about things like I would in C++ with destructors. I
guess one should favor notifications in Cocoa over such designs.
thanks,
wes
On Dec 19, 2007 1:19 AM, Wesley Smith <email@hidden> wrote:
> I have a custom subclass of NSWindow that I've defined a dealloc
> method for as so:
>
> - (void)dealloc
> {
> [ogl_view release];
> NSZoneFree([self zone], [self zone]);
> [super dealloc];
> }
>
> Things work fine until the program hits "[super dealloc];". At that
> point, I get a crash every time and the stack looks like this:
>
> #0 0x0181b028 in ??
> #1 0x900052ef in free
> #2 0x9080dfc0 in CFRelease
> #3 0x932aeabe in -[NSWindow _setWindowNumber:]
> #4 0x9333d0da in -[NSWindow _termWindowIfOwner]
> #5 0x9333c2c5 in -[NSWindow dealloc]
> #6 0x004386bb in -[CocoaOpenGLWin dealloc] at cocoa_opengl_win.m:51
>
>
> I'm not sure what's going on at all. What are the mechanics of
> deallocating a custom NSWindow subclass? I feel I'm missing something
> crucial here because even when I pare the class down to almost
> nothing, it still crashes.
>
> thanks,
> wes
>
_______________________________________________
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