RE: Managing Retain/Release for a ContentView
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.