• 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: Using proxy objects with NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using proxy objects with NSMutableArray


  • Subject: Re: Using proxy objects with NSMutableArray
  • From: Michael Tyson <email@hidden>
  • Date: Sat, 14 Jul 2007 09:43:17 +1000

Oh, fantastic!!  That was it!

I see, so no taking liberties with standard practice unless explicitly told to. My mistake =)

Thanks heaps, I'm not sure I would have picked that one.

On 14/07/2007, at 2:15 AM, John Shockey wrote:

Looking again at your code, I think I see an additional problem. And again, it's the sort of thing that could cause all sorts of odd behavior, though I'm not specifically sure of what you're seeing.

The documentation for "unarchiver:didDecodeObject:" doesn't say anything about retaining and releasing objects, so I would assume that you're expected to follow the normal procedure. That would mean you should not release the object you receive, even when you are returning something else. I would also assume that you should be returning an autoreleased object as the replacement, and not retaining it. It is presumably the responsibility of NSKeyedUnarchiver to handle all that.

(To reinforce that, if you look at the methods "replacementObjectForCoder:" and "awakeAfterUsingCoder:" defined on NSObject, the documentation for the latter DOES tell you to release the object if you're returning something else. I'm not suggesting that you need to use these methods instead -- just observing that Apple's documentation is generally pretty explicit where you need to differ from standard memory management behavior.)

-- Michael Tyson | michael.tyson.id.au

m: (+61) 0407 754 124
e: email@hidden
aim: mikerusselltyson

_______________________________________________

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


References: 
 >Using proxy objects with NSMutableArray (From: Michael Tyson <email@hidden>)
 >Re: Using proxy objects with NSMutableArray (From: John Shockey <email@hidden>)
 >Re: Using proxy objects with NSMutableArray (From: Michael Tyson <email@hidden>)
 >Re: Using proxy objects with NSMutableArray (From: John Shockey <email@hidden>)

  • Prev by Date: Re: runtime execution path for NSTask
  • Next by Date: Re: using appendBezierPathWithPoints
  • Previous by thread: Re: Using proxy objects with NSMutableArray
  • Next by thread: Re: Using proxy objects with NSMutableArray
  • Index(es):
    • Date
    • Thread