Re: Window controller dealloc never called
Re: Window controller dealloc never called
- Subject: Re: Window controller dealloc never called
- From: Ken Tozier <email@hidden>
- Date: Tue, 29 Aug 2006 13:36:39 -0400
Here's a less verbose look at the problem
Floating palette containing various page manipulation tools is opened
using this
- (void) showDocTools
{
if (docTools == nil)
docTools = [[XTDocumentToolsPalette alloc] initWithPlugin: self];
[docTools show];
}
Floating palette init method
- (id) initWithPlugin:(XTPlugin *) inPlugin
{
NSString *path = [[inPlugin bundle] pathForResource:
@"PaginationTools" ofType: @"nib"];
if (self = [super initWithWindowNibPath: path owner: self])
{
plugin = inPlugin;
currentTool = nil;
// get the tool list
path = [[plugin bundle] pathForResource: @"XTToolList" ofType:
nil];
NSMutableArray *tempToolList = [[NSMutableArray alloc]
initWithContentsOfFile: path];
// Set tool name list using accessor so UI will notice the change
[self setTools: tempToolList];
[self setShouldCloseDocument: YES];
}
return self;
}
Individual tool dialogs and windows within the palette are created in
this
- (void) performDoubleClick
{
NSLog(@"entered performDoubleClick");
if ([selectedTool count] > 0)
{
unsigned int index = [selectedTool firstIndex];
NSDictionary *temp = [toolList objectAtIndex: index];
NSString *name = [temp objectForKey: @"name"];
if ([name isEqualToString: @"New Weekly Document"])
[plugin createDocumentDialogWithWindowNibName: @"NewWeeklyDocument"];
else if ([name isEqualToString: @"Open Document"])
[plugin createDocumentDialogWithWindowNibName:
@"OpenWeeklyDocument"];
else if ([name isEqualToString: @"Set Page Number"])
[plugin createSectionStartDialog];
else if ([name isEqualToString: @"Import Ads"])
[plugin importAds];
else if ([name isEqualToString: @"Pub Status"])
[plugin pubStatusDialog];
}
}
Individual tool init methods all follow this pattern
- (id) initWithPlugin:(XTPlugin *) inPlugin
{
NSString *path = [inPlugin pathForResource: @"SectionStart" ofType:
@"nib"];
NSLog(@"nib path = %@", path);
if (self = [super initWithWindowNibPath: path owner: self])
{
plugin = inPlugin;
prefix = nil;
number = nil;
[self setShouldCloseDocument: YES];
// run panel as a modal dialog
[[NSApplication sharedApplication] runModalForWindow: [self window]];
}
return self;
}
Modal windows are closed like this
[[NSApplication sharedApplication] stopModal];
[self close];
Anyone see anything in the above that would prevent dealloc for every
single window I open?
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