NSTextView CoreData binding and UndoManager

  • Hi,

    I have an NSTextView that is bound to an NSString in Core Data.

    The NSTextView is contained an NSScrollView which is contained in an

    I have set [NSUndoManager setLevelsOfUndo:20]

    In Interface Builder I have checked allows Undo for the NSTextView

    I am running on Leopard 10.5 using the Xcode 2.4 option and compiling
    for OS X 10.4 (Universal), I tried XCode 3/0 and compiling for 10.5
    but it makes no difference.

    If I run it on Leopard and make 21 changes to the data in the
    NSTextField, with 21 moc saves, I get a crash with the following trace:

    Thread 0 Crashed:
    0  libobjc.A.dylib                   0x948366e4 objc_msgSend + 20
    1  com.apple.Foundation             0x95ff644e -[_NSUndoStack markEnd]
    + 110
    2  com.apple.CoreFoundation         0x947a8bac -[NSSet
    makeObjectsPerformSelector:withObject:] + 188
    3  com.apple.Foundation             0x95fd4bd0 +
    [NSUndoManager(NSUndoManagerPrivate) _endTopLevelGroupings] + 128
    4  com.apple.AppKit                 0x931bd71d -[NSApplication run] + 871
    5  com.apple.AppKit                 0x9318a9ba NSApplicationMain + 574
    6  com.<myApplication>         0x00002bce _start + 216
    7  com.<myApplication>         0x00002af5 start + 41

    The moc saves are activated whenever the user moves the focus to a
    field somewhere else in my application of selects a different tab in
    the TabView.

    If I run the same compiled executable code on OS X 10.4.10 Tiger then
    it works fine.

    If I change the levels of undo to "n" it will crash after "n"
    iterations of change/save of the data in the NSTextView.

    If, in Inteface Builder,  I turn off the check box for Undo for the
    NSTextView and recompile then it works fine on Leopard but, of course,
    the user loses the ability to undo whilst using the NSTextView.

    In Leopard there seems to be some contention/confusion between
    NSTextView's undoManager and Core data's undoManager.

    Is this a known problem? Is there a work around?

previous month november 2007 next month
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today