• 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: Managing Retain/Release for a ContentView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Managing Retain/Release for a ContentView


  • Subject: RE: Managing Retain/Release for a ContentView
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Tue, 12 Aug 2003 18:03:15 -0400

> exptWindow = [[ExptWindow alloc] initWithFrame:NSMakeRect(64,64,800,600)];

[snip]

> pmView = [[PM1View alloc] initWithFrame:[exptWindow frame]];

[snip]

> [exptWindow setContentView: pmView];

One thing that hasn't been mentioned is that if you do not release pmView,
you are probably going to leak. Presumably, once pmView becomes the content
view of exptWindow, you want pmView to be dealloced when the window is. As
it is now, it looks like pmView will have a retain count of 1 after the
window deallocs.

If you want pmView to die when exptWindow does, you should either
autorelease pmView when it is created, or release it after it becomes the
content view.

Jonathan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Managing Retain/Release for a ContentView (From: Joel Lachter <email@hidden>)

  • Prev by Date: Re: Upside Down
  • Next by Date: Re: NSDocument's loadDataRepresentation called before the document UI is functional?
  • Previous by thread: Re: Managing Retain/Release for a ContentView
  • Next by thread: Re: Managing Retain/Release for a ContentView
  • Index(es):
    • Date
    • Thread