• 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
Help : Releasing NSWindowController object ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help : Releasing NSWindowController object ?


  • Subject: Help : Releasing NSWindowController object ?
  • From: "K.K.Chan" <email@hidden>
  • Date: Tue, 4 Jun 2002 14:22:03 +0800

Hello,

I have ask this question before, but get no reply.

I just want to know, is it safe to release NSWindowController subclass object ?

As far as I know, after object loads a nib, it should not be release. Now I am
not sure.


Thanks.

K.K.Chan



// call from main nib
- (IBAction)openPref:(id)sender
{
NSAutoreleasePool *pool;
id aWindow;

pool = [[NSAutoreleasePool alloc] init];
aWindow = [[PrefController singleInstance] window];

if ( aWindow )
[NSApp runModalForWindow: aWindow];
[pool release];
}

// @interface PrefController : NSWindowController

@implementation PrefController

- (id) initWithWindowNibName: (NSString *) windowNibName
{
self = [super initWithWindowNibName: windowNibName];
return self;
}

- (void) windowWillClose: (NSNotification *) theNotification
{
[self autorelease]; // <=== is this safe ?
singleInstance = nil;
[NSApp stopModal];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Help : Releasing NSWindowController object ?
      • From: Gareth White <email@hidden>
  • Prev by Date: Re: Color comparison
  • Next by Date: Re: Hunting for System Preferences
  • Previous by thread: Re: Connect to web address...
  • Next by thread: Re: Help : Releasing NSWindowController object ?
  • Index(es):
    • Date
    • Thread