• 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
NSUndoManager retain/release of arguments - ad infinitum
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUndoManager retain/release of arguments - ad infinitum


  • Subject: NSUndoManager retain/release of arguments - ad infinitum
  • From: John Bartleson <email@hidden>
  • Date: Sun, 09 Jan 2011 00:19:11 -0800

Can someone PUH-LEASE clear up the confusion re NSUndoManager retaining/releasing arguments to prepareWithInvocationTarget:?

In various places in cocoa-dev and in referenced 'net articles, such as here <http://cocoadev.com/index.pl?NSUndoManagerTutorial>
and here <http://lists.apple.com/archives/cocoa-dev/2001/Jul/msg00682.html > it says that arguments ARE retained.
In Apple's own documentation ("Undo Architecture") and here <http://cocoadev.com/index.pl?NSUndoManager > it says that
arguments ARE NOT retained.


Which is it? I get the impression that some time in the last ten years an Apple developer changed this and
then went off to a tragic death in Cupertino traffic without anyone officially documenting the change.


I've wasted untold days of what could have been productive time trying to straighten this out. How many others have wasted their time?

If a change was made, when was it made (in what version of Mac OS X)? How do we maintain both old and new code to support this properly?

If we check the before/after retain counts of prepareWithInvocationTarget: arguments, it appears that the arguments ARE being retained.
But wait! According to Apple's guidelines we're not supposed to use retainCount for this purpose.


And we lose an innocent bystander in the confusion: the supposedly hard and fast rule that if you create an object with alloc, new,
copy, or mutableCopy you are responsible for releasing it, otherwise you're not responsible for releasing it.


Apparently, the rule should be supplemented with "But if you create an object with alloc, new, copy, or mutableCopy, then pass it
as an argument to prepareWithInvocationTarget: you're not responsible for releasing it."


Your comments, please....
_______________________________________________

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: NSUndoManager retain/release of arguments - ad infinitum
      • From: Graham Cox <email@hidden>
    • Re: NSUndoManager retain/release of arguments - ad infinitum
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Avoid selection of text in NSTextField
  • Next by Date: Re: NSUndoManager retain/release of arguments - ad infinitum
  • Previous by thread: Re: Avoid selection of text in NSTextField
  • Next by thread: Re: NSUndoManager retain/release of arguments - ad infinitum
  • Index(es):
    • Date
    • Thread