Skip navigation.
 
mlRe: Window controller dealloc never called
FROM : Ken Tozier
DATE : Tue Aug 29 19:36:39 2006

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

Related mailsAuthorDate
mlWindow controller dealloc never called Ken Tozier Aug 29, 09:17
mlRe: Window controller dealloc never called Ken Tozier Aug 29, 19:36
mlRe: Window controller dealloc never called Matt Neuburg Aug 29, 21:21
mlRe: Window controller dealloc never called Nir Soffer Sep 3, 01:09