Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash on custom NSWindow subclass dealloc



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >crash on custom NSWindow subclass dealloc (From: "Wesley Smith" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.