• 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: More NSUndoManager woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: More NSUndoManager woes
      • From: Graham Cox <email@hidden>
References: 
 >More NSUndoManager woes (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Beginner TableView Questions
  • Next by Date: Re: More NSUndoManager woes
  • Previous by thread: More NSUndoManager woes
  • Next by thread: Re: More NSUndoManager woes
  • Index(es):
    • Date
    • Thread