• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSWindow Subclass close/dealloc question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSWindow Subclass close/dealloc question
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Swift: How to determine if a Character represents whitespace?
  • Next by Date: Re: NSWindow Subclass close/dealloc question
  • Previous by thread: Re: Swift: How to determine if a Character represents whitespace?
  • Next by thread: Re: NSWindow Subclass close/dealloc question
  • Index(es):
    • Date
    • Thread