Re: More NSUndoManager woes
Re: More NSUndoManager woes
- Subject: Re: More NSUndoManager woes
- From: Alastair Houghton <email@hidden>
- Date: Wed, 9 Apr 2008 14:09:15 +0100
On 9 Apr 2008, at 12:23, Graham Cox wrote:
The docs for NSUndoManager state for -removeAllActionsWithTarget:
that:
"An object that shares an NSUndoManager with other clients should
invoke this message in its implementation of dealloc".
There is a problem with this - if the object being dealloced is
itself the parameter to an undo invocation, which in anything more
complicated than a trivial test case it is likely to be, then Cocoa
goes into an infinite loop when it starts discarding these
invocations off the bottom of the stack. The undo manager releases
the invocation which releases the object, which calls -
removeAllActionsWithTarget:self, and boom - it all falls over.
I'm not sure I see why you're getting into an infinite loop here. -
dealloc should be being called at most once, right?
And it shouldn't be possible to get into a situation where your object
is the parameter of an undo operation if you're already in that
object's -dealloc routine. If that's what you're seeing, you have a
reference counting bug I think.
Perhaps I'm misunderstanding the problem though?
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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