makeWindowControllers and memory leaks
makeWindowControllers and memory leaks
- Subject: makeWindowControllers and memory leaks
- From: Kaspar Fischer <email@hidden>
- Date: Thu, 10 Nov 2005 11:13:55 +0100
Hi all,
After playing around for a while, I found out that you have
to release window controllers that you create in a document's
-makeWindowControllers method before adding them using
-addWindowController:. In other words, you cannot ommit
the "autorelease" in
- (void)makeWindowControllers
{
ProjectWindowController *pc = [[[ProjectWindowController alloc]
init] autorelease];
[self addWindowController:pc];
}
(If you ommit "autorelease", your window will not get
deallocated).
Is this the correct way to make window controllers?
(I am asking because I have seen many examples on this
mailing list where there was NO autorelease in the
-makeWindowControllers code.)
Another question I have is: Using the code above, my
window gets properly deallocated. But what does this
have to do with the setting "Release when closed" in
Interface Builder's inspector for the window? No matter
whether I select this option or not, the window gets
released properly. So what is this option for?
Thanks,
Kaspar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden