Skip navigation.
 
mlHow to debug CoreData/NSTreeController crash during undo? (was: NSUndoManager - grouping undo actions...)
FROM : Dave Fernandes
DATE : Fri Apr 27 22:13:13 2007

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:withRefreshes
:]
#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


On Apr 25, 2007, at 5:54 PM, Dave Fernandes wrote:

> I am having trouble getting the desired behavior for undoing 
> actions in a CD app. My immediate problem is that I would like to 
> group some actions across events.
>
> I tried [undoManager beginUndoGrouping] with a matching 
> [undoManager endUndoGrouping], but I get a crash when undoing.

Related mailsAuthorDate
mlNSUndoManager - grouping undo actions in Core Data Dave Fernandes Apr 25, 23:54
mlHow to debug CoreData/NSTreeController crash during undo? (was: NSUndoManager - grouping undo actions...) Dave Fernandes Apr 27, 22:13