> I have taken all advice and the code now looks like below which cleans up the 
> pointed out controller leak and does not store [self window]:

There still seems to be some problems with your code...

> - (IBAction)sewing:(id)sender {
> 
>       [[[SewingController alloc] initWithWindowNibName:@"Sewing and Color" 
> andBFileName:&mBFilename] release];
> }

You allocate and immediately release the controller here... not quite sure what 
you're trying to do here, but that basically means you don't have a controller 
object, and your window will not stay onscreen. Have you actually tested this 
code?

> - (id) initWithWindowNibName:(NSString*)windowNibName 
> andBFileName:(BFilename*)bfilename
> {
>       self = [super initWithWindowNibName:windowNibName];
>       if (self != nil)
>       {
>               [self retain];
>               m_design = [[self window] contentView];
> 
>               
>               [[self window] setDelegate:self];
>       }
>       return self;
> }

Once again, no point in hanging on to the content view and storing it in an 
ivar, because just like the window, it's easily accessible from -window 
-contentView. Unless it's a custom view, but I do not see a cast here... Also, 
do you have a reason for retaining self?

> 
> - (void)windowWillClose:(NSNotification *)notification {
> 
>       if(m_design->m_dirtyDesign)
>               NSLog(@"dirty message");
>       else
>               NSLog(@"clean, no message");
>       [self release];
> }

This -release is interesting as 
well._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to