• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sanity Check
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sanity Check


  • Subject: Re: Sanity Check
  • From: John Johnson <email@hidden>
  • Date: Thu, 8 Jul 2010 11:30:22 -0500

> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Sanity Check
      • From: email@hidden
References: 
 >Sanity Check (From: email@hidden)
 >Re: Sanity Check (From: Mike Abdullah <email@hidden>)
 >Re: Sanity Check (From: email@hidden)
 >Re: Sanity Check (From: Sherm Pendley <email@hidden>)
 >Re: Sanity Check (From: email@hidden)

  • Prev by Date: Re: Sanity Check
  • Next by Date: Re: Programmatically highlighting an NSMenuItem
  • Previous by thread: Re: Sanity Check
  • Next by thread: Re: Sanity Check
  • Index(es):
    • Date
    • Thread