[WORKAROUND] Re: How to debug CoreData/NSTreeController crash during undo?
[WORKAROUND] Re: How to debug CoreData/NSTreeController crash during undo?
- Subject: [WORKAROUND] Re: How to debug CoreData/NSTreeController crash during undo?
- From: Dave Fernandes <email@hidden>
- Date: Sat, 26 May 2007 13:58:12 -0400
Thanks to George for pointing out this post to me. The link to
http://www.cocoadev.com/index.pl?NSTreeControllerBugOrDeveloperError
(bottom of page) describes how to patch _NSArrayControllerTreeNode to
fix the problem. My app now has stable undo-redo with the
NSTreeController and Core Data.
It is perhaps not very forward compatible, but at least it works for
now.
Dave
On May 3, 2007, at 4:41 PM, George Orthwein wrote:
I found a tip with posing that solved the errors I was getting on
Undo with NSTreeController:
http://www.cocoabuilder.com/archive/message/cocoa/2006/7/6/166974
The
Begin forwarded message:
From: Dave Fernandes <email@hidden>
Date: April 27, 2007 4:13:13 PM EDT (CA)
To: Cocoa-Dev Developer <email@hidden>
Subject: How to debug CoreData/NSTreeController crash during undo?
(was: NSUndoManager - grouping undo actions...)
I have a crash in a core data app that I am having trouble
debugging. After narrowing down the problem, I find it has nothing
to do with grouping undo items as I had originally thought. Rather
the crash happens reliably on both Intel and PowerPC when certain
operations are done in a specific order.
Can anyone suggest strategies to debug this?
Thanks,
Dave
STEPS
1. Insert a couple objects into MOC in an NSPersistentDocument.
2. Modify attributes of these objects.
3. Undo all actions.
4. Redo all actions.
5. Insert 6 or more new objects into MOC.
6. Modify attributes of these new objects.
7. Undo the changes.
8. Undo the insertion of the 6 objects.
- crash with exception below.
EXCEPTION
2007-04-27 15:52:01.451 MyApp[563] Exception raised during posting
of notification. Ignored. exception: *** -[NSCFArray
objectAtIndex:]: index (2) beyond bounds (2)
CALL STACK
#0 0x9282438d in -[NSException raise]
#1 0x9284b23f in +[NSException raise:format:]
#2 0x928a81fc in _NSArrayRaiseBoundException
#3 0x927da9f1 in -[NSCFArray objectAtIndex:]
#4 0x9383e65e in -[_NSArrayControllerTreeNode updateSubnodes]
#5 0x938358dc in -[_NSArrayControllerTreeNode setObservedObject:]
#6 0x9383775c in -[NSTreeController _prepareArrayControllerTree]
#7 0x9383af75 in -[NSTreeController setContent:]
#8 0x937e95c4 in -[_NSManagedProxy _managedObjectsChangedInContext:]
#9 0x927e917b in _nsnote_callback
#10 0x908573e6 in __CFXNotificationPost
#11 0x9084ebd1 in _CFXNotificationPostNotification
#12 0x927e1724 in -[NSNotificationCenter
postNotificationName:object:userInfo:]
#13 0x93cba42b in -[NSManagedObjectContext
(_NSInternalNotificationHandling)
_postObjectsDidChangeNotificationWithUserInfo:]
#14 0x93cba3aa in -[NSManagedObjectContext
(_NSInternalChangeProcessing)
_createAndPostChangeNotification:withDeletions:withUpdates:withRefresh
es:]
#15 0x93cb975d in -[NSManagedObjectContext
(_NSInternalChangeProcessing) _processRecentChanges:]
#16 0x93cb932d in -[NSManagedObjectContext processPendingChanges]
#17 0x93cd2224 in -[NSManagedObjectContext
(_NSInternalNotificationHandling) _processEndOfEventNotification:]
#18 0x927e917b in _nsnote_callback
#19 0x908573e6 in __CFXNotificationPost
#20 0x9084ebd1 in _CFXNotificationPostNotification
#21 0x927e1724 in -[NSNotificationCenter
postNotificationName:object:userInfo:]
#22 0x927e86c9 in -[NSNotificationCenter postNotificationName:object:]
#23 0x9284b835 in -[NSUndoManager(NSUndoManagerPrivate)
_postCheckpointNotification]
#24 0x9284b6fe in -[NSUndoManager endUndoGrouping]
#25 0x928a3f6f in -[NSUndoManager undoNestedGroup]
#26 0x9337cd88 in -[NSApplication sendAction:to:from:]
#27 0x00084bc5 in -[MyApp sendAction:to:from:] at MyApp.m:114
#28 0x9342ace7 in -[NSMenu performActionForItemAtIndex:]
#29 0x9342aa29 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:]
#30 0x9342a680 in -[NSMenu performKeyEquivalent:]
#31 0x9342a121 in -[NSApplication _handleKeyEquivalent:]
#32 0x9335dd87 in -[NSApplication sendEvent:]
#33 0x93288dfe in -[NSApplication run]
#34 0x9327cd2f in NSApplicationMain
#35 0x0000cffc in main at main.m:13
_______________________________________________
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