Re: Undomanager and deallocate
Re: Undomanager and deallocate
- Subject: Re: Undomanager and deallocate
- From: "Mark's Studio" <email@hidden>
- Date: Tue, 30 Oct 2001 10:24:00 +0100
Thanks for your replay
I will try that.
On tirsdag, oktober 30, 2001, at 10:20 , David Remahl wrote:
>
> What is the correct way of doing this, if any?
>
>
>
> [[self undoManager] registerUndoWithTarget:self
>
> selector:@selector(undoMethod:) object:[myObject copy]];
>
>
>
> [[self undoManager] registerUndoWithTarget:self
>
> selector:@selector(undoMethod:) object:[[myObject copy] autorelease]];
>
>
>
> will the undoManager deallocate myObject when it's finish with it.
>
> i have only tried [myObject copy] and it works without any errors, so
>
> is
>
> that ok?
>
>
The second way is the correct one, or the object created by the copy
>
call
>
will be lost. What you either copy or retain, you also nead to release.
>
Doing it the first way would not create an error, but the object would
>
leak.
>
>
/ david
>
>
>
Peter Mark
Mark's Recording Studio A/S
Faelledvej 19 b DK2200 N
Copenhagen Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden