• 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: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash


  • Subject: Re: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
  • From: Graham Cox <email@hidden>
  • Date: Fri, 1 Jan 2010 11:30:55 +1100

On 01/01/2010, at 4:36 AM, Jerry Krinock wrote:

> Does a better workaround pop into anyone's mind?  The crash does not occur when using Apple's NSUndoManager, which I presume must also have some workaround built into it.


Jerry,

Obviously there's a Mea Culpa in here for GCUndoManager.

I think the problem comes down to that for simplicity I set the target on the invocation, then call -retainArguments, which then retains the target. If the target is the document that owns the undo manager, that is a retain cycle. I'm aware of that, but for my situation it was safer to retain the invocation's targets than not, so I left it that way. NSUndoManager does not retain its targets, but I have found that does lead to some situations where it holds stale target references.

You seem to have uncovered a slightly different problem this leads to, but I think the root cause is the same.

It's straightforward enough to change the behaviour to not retain the target - call -retainArguments before setting the invocation's target. I will add a method on GCUndoManager so it can be set to retain its targets or not.

--Graham


_______________________________________________

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: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
      • From: Graham Cox <email@hidden>
References: 
 >NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Setting the Line Height/ Line Spacing in an NSTextView.
  • Next by Date: Landscape view drawing as if in portrait mode
  • Previous by thread: Re: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
  • Next by thread: Re: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
  • Index(es):
    • Date
    • Thread