Window controller dealloc never called
Window controller dealloc never called
- Subject: Window controller dealloc never called
- From: Ken Tozier <email@hidden>
- Date: Tue, 29 Aug 2006 03:17:16 -0400
Hi
During development of a Quark plugin, I came up with a way to load my
window and dialog nibs which works but now that I'm approaching
delivery, I need a way to make sure that the windows I open are
released. In tests, none of the windows and dialogs ever get released
which is, I suspect, causing a huge memory leak.
Due to the fact that Quark XTensions are located in a folder outside
of the Quark application bundle, the nib loading problem is a bit
unique. I can't use [[NSBundle mainbundle] pathForResource:ofType:]
or either of NSWindowController's "initWithWindowNibName:" or
"initWithWindowNibName:owner:" methods from within the plugin because
it only gives me access to the Quark bundle and that's not where my
nibs are located.
What I ended up doing is creating my own bundle loader and nib
location code and feeding the resultant paths to NSWindowController's
initWithWindowNibPath:owner: method. Here's a typical window init
method for my various dialogs
- (id) initWithPlugin:(XTPlugin *) inPlugin
{
NSString *path = [[inPlugin bundle] pathForResource:
@"PaginationTools" ofType: @"nib"];
if (self = [super initWithWindowNibPath: path owner: self])
{
/* window specific init code here */
}
return self;
}
While this works well enough for development, I suspect that the
"(self = [super initWithWindowNibPath: path owner: self])" line is
causing an infinite loop on window dealloc as the owner of the thing
that is being dealloc'd is the thing itself. Since I'm forced into
using initWithWindowNibPath, is there any other way I can do this
that will absolutely guarantee window dealloc?
Thanks in advance
Ken
_______________________________________________
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