Re: NSDocument, NSManagedObjectContext do Stuff in -dealloc, Cause Crash
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com
participants (1)
-
Graham Cox