• 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
Re: How to completely release every object allocated when opening a NIB file ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to completely release every object allocated when opening a NIB file ?


  • Subject: Re: How to completely release every object allocated when opening a NIB file ?
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 14 Jan 2004 00:27:03 -0800

On Jan 12, 2004, at 1:15 AM, Jirome Foucher wrote:
I'm having big problems stopping my application from leaking.
- Here's the short story :
My app loads differents NIB files using
[NSBundle loadNibFile:path externalNameTable:NULL withZone:NSDefaultMallocZone()];
The NIB file only holds a NSWindow which is set to release when closed. The owner is a NSWindowController.

It's not clear why you're using NSBundle to load the nib file in this case (where the File's owner is an NSWindowController)?

I'd expect to see something more like:

- (IBAction)makeNewWindow:(id)sender
{
MyWindowController *wc = [[MyWindowController alloc] init];
[windowsArray addObject:wc];
[wc release];
[wc showWindow:nil];

[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(wcWindowClosed:)
name:NSWindowWillCloseNotification
object:[wc window]];

}

- (void)wcWindowClosed:(NSNotification *)note
{
MyWindowController *wc = [[note object] delegate];
[windowsArray removeObject:wc];
}


(You'd override windowNibName in MyWindowController

- (NSString *)windowNibName
{
return @"MyWindow";
}

)

Then I don't think you should have problems?

mmalc
_______________________________________________
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: How to completely release every object allocated when opening a NIB file ?
      • From: Charles Srstka <email@hidden>
References: 
 >How to completely release every object allocated when opening a NIB file ? (From: Jérome Foucher <email@hidden>)

  • Prev by Date: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by Date: Re: [help!] a strange crash (to me)...
  • Previous by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by thread: Re: How to completely release every object allocated when opening a NIB file ?
  • Index(es):
    • Date
    • Thread