NSWindow Subclass close/dealloc question
NSWindow Subclass close/dealloc question
- Subject: NSWindow Subclass close/dealloc question
- From: Dave <email@hidden>
- Date: Thu, 02 Apr 2015 16:56:04 +0100
Hi,
I’m getting a crash in dealloc in an NSWindow Subclass.
I have a class that creates and closes Windows based on Notifications received from elsewhere. One of the Notifications is “CloseWindow”.
I added this to my subclass:
-(void) close
{
LogIfDave(@"Overlay close");
[super close]; //Crashes with this line in, ok without.
}
-(void) dealloc
{
LogIfDave(@"Overlay dealloc");
self.prop1 = nil;
self.prop2 = nil;
self.prop3 = nil;
[super dealloc];
}
The Call Sequence when I get the notification is:
[self.overlay close];
self.overlay = nil; //this causes release to be called, e.g. the retainCount is == 1,
overlay is defined as:
@property (nonatomic,retain) LTWOverlay* overlay;
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?
All the Best
Dave
_______________________________________________
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