Re: Undo prepareWithInvocationTarget: retain/release question
Re: Undo prepareWithInvocationTarget: retain/release question
- Subject: Re: Undo prepareWithInvocationTarget: retain/release question
- From: "Erik M. Buck" <email@hidden>
- Date: Tue, 8 Mar 2005 19:56:01 -0500
Undo follows the same conventions for releasing objects as everything else
in Cocoa.
I did not see any place in the code posted where you explicitly
alloc/retain/copy aView. Therefore, I would be very surprised if you are
happy with the result of explicitly releasing aView.
If you did not explicitly alloc/copy/retain and object you are not
responsible for (and should not) explicitly release or autorelease it.
If you did explicitly alloc/copy/retain and object you are responsible for
ultimately explicitly sending release or autorelease to it.
Why do you say "...I know I have to release an object after adding it as a
subview..." What on earth gave you that idea ?
Adding an object as a subview is NOT explicitly alloc/copy/retaining the
object in YOUR CODE. If the view to which you just added a sub-view
implicitly retains the sub-view (as I am sure it does), that is not your
concern. To paraphrase "The Princes Bride," if you didn't type it, you
didn't do it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden