• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
inserting/removing items in NSOutlineView subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inserting/removing items in NSOutlineView subclass


  • Subject: inserting/removing items in NSOutlineView subclass
  • From: Sebastien Boisvert <email@hidden>
  • Date: Sat, 22 Oct 2011 19:56:51 -0700 (PDT)

I have an NSOutlineView subclass that does the following to remove a row:

[selfbeginUpdates];
[selfremoveItemsAtIndexes:[NSIndexSetindexSetWithIndex:editingRow] inParent:nilwithAnimation:NSTableViewAnimationEffectNone];
[selfendUpdates];

However, when the above runs, I get the following exception:

*** Assertion failure in -[MyOutlineView _doUpdatedWorkWithHandler:], /SourceCache/AppKit/AppKit-1138.23/TableView.subproj/NSTableView.m:14634
Exception detected while handling key input.
Exception Name: NSInternalInconsistencyException
Exception Reason: NSTableView Error: Insert/remove/move only works within a -beginUpdates/-endUpdates block.


Huh? The row index is valid, I'm not overriding any of the above methods, and the calls are balanced, so I don't know why I get this.

I get the same thing if I try to add a row, but discovered that if I have the outline view's delete do it instead, that works, but don't know/explain why. Unfortunately I can't use that workaround in the situation I use the code above for.

Any ideas?


Here's the relevant part of the stack trace:

0   CoreFoundation                      0x00007fff8672c286 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff8aad4d5e objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8672c0ba +[NSException raise:format:arguments:] + 106
3   Foundation                          0x00007fff8c4757d3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 169
4   AppKit                              0x00007fff8e89f32b -[NSTableView _doUpdatedWorkWithHandler:] + 133
5   AppKit                              0x00007fff8ebd5f35 -[NSOutlineView removeItemsAtIndexes:inParent:withAnimation:] + 214
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: inserting/removing items in NSOutlineView subclass
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: core data store type and icloud
  • Next by Date: Re: core data store type and icloud
  • Previous by thread: Re: core data store type and icloud
  • Next by thread: Re: inserting/removing items in NSOutlineView subclass
  • Index(es):
    • Date
    • Thread