Re: inserting/removing items in NSOutlineView subclass
Re: inserting/removing items in NSOutlineView subclass
- Subject: Re: inserting/removing items in NSOutlineView subclass
- From: Corbin Dunn <email@hidden>
- Date: Mon, 24 Oct 2011 08:45:27 -0700
hi sebastien,
Are you sure you are calling beginUpdates? At what point are you doing the code below in your subclass? Also, can you post the complete stack trace?
If you think it is a bug in appkit, please log it at bugreporter.apple.com -- but please include a test app, as I haven't been able to reproduce this myself, and this is the first i've heard of the method not working.
corbin
On Oct 22, 2011, at 7:56 PM, Sebastien Boisvert wrote:
> 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
_______________________________________________
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