• 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: Encoding infinite loops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encoding infinite loops


  • Subject: Re: Encoding infinite loops
  • From: Uli Kusterer <email@hidden>
  • Date: Tue, 22 May 2007 10:10:12 +0200

On 21.05.2007, at 18:47, Chris Kane wrote:
Consider for a moment an object unarchiving itself. The unarchiver has created the object for that reference in the archive and is initializing it. The object unarchives a bunch of other state, some of which is more objects. If one of the subobjects has a reference to the original object, and unarchives that, the unarchiver happily gives it the object which it has already created for that object -- but in this case note that that object is still initializing itself. This can create two sorts of problems, but in the lucky case everything unwinds and things work out and the recursive reference has been restored by the unarchiver.

Err... you mean this class is documented as handling several references to the same object ... but doesn't?


Can't you just keep a original pointer -> object dictionary (which contains the object that actually was unarchived, not any temporary object that might have been replaced) and just look up each object in the graph that way? This is a problem that's been solved so many times over that I'm kind of embarrassed that a framework like Cocoa doesn't handle this, and moreover is unable to fail gracefully in that case instead of unarchiving garbage objects.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Encoding infinite loops
      • From: Chris Kane <email@hidden>
References: 
 >Encoding infinite loops (From: Will Thimbleby <email@hidden>)
 >Re: Encoding infinite loops (From: Chris Kane <email@hidden>)

  • Prev by Date: Re: Cutsom NSRulerView : strange problems with drawing
  • Next by Date: Re: Cutsom NSRulerView : strange problems with drawing
  • Previous by thread: Re: Encoding infinite loops
  • Next by thread: Re: Encoding infinite loops
  • Index(es):
    • Date
    • Thread