• 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
retain/release question about Apple docs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

retain/release question about Apple docs


  • Subject: retain/release question about Apple docs
  • From: "James W. Walker" <email@hidden>
  • Date: Sun, 5 Mar 2006 17:43:07 -0800

In Apple's "Text System Overview", under "Building a Text Editor in 15 Minutes", there is the code:

- (void) setString: (NSAttributedString *) newValue {

    if (mString != newValue) {

        [newValue retain];

        if (mString) [mString release];

        mString = [newValue copy];

        [newValue release];

    }

}

I thought I understood the retain/release/autorelease business, but I can't see the need for the [newValue retain] and [newValue release] here.
_______________________________________________
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
  • Follow-Ups:
    • Re: retain/release question about Apple docs
      • From: Volker Runkel <email@hidden>
    • Re: retain/release question about Apple docs
      • From: Andy Lee <email@hidden>
    • Re: retain/release question about Apple docs
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: NSArrayController's contentArray and selectedIndexes don't match when sorted
  • Next by Date: Re: Issues with NSTextView and undoing attributes - Update
  • Previous by thread: objectSpecifier for a dictionary?
  • Next by thread: Re: retain/release question about Apple docs
  • Index(es):
    • Date
    • Thread