NSUndoManager invalid state

  • Hi,
    I get the message

    1/4/08 6:14:13 AM TestUndoApp[1489] undo: NSUndoManager 0x142c1820 is in
    invalid state, undo was called with too many nested undo groups

    I get this error only when I return newChild in the function here below.
    If I return nil, or any other value, the undo works well. Why?

    - (id)AddItem:(NSDictionary*)itemDict
    {
        // I add here the item
        id newChild = [treeNode AddItemWithDict:itemDict];

        [[gKMUndoManager prepareWithInvocationTarget:self] DeleteItem:newChild];
        [gKMUndoManager setActionName:@"Add Item"];

        return newChild;
        // if I return nil or itemDict or any other id, the undo works well.
    }

    I have read here some post about the same trouble, but cannot find the
    solution. Any pointer?

    Best Regards
    --
    Lorenzo
    email: <archidea...>
previous month january 2008 next month
MTWTFSS
  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 31      
Go to today