App crashes on trying to customize touch bar items.

Originator:dbezverkhnii
Number:rdar://29969759 Date Originated:11 Jan 2017
Status:Open Resolved:
Product:macOS + SDK Product Version:10.12.2
Classification:Bug Reproducible:100%
 
If there is a nested NSTouchBar (using NSTouchBarItemIdentifierOtherItemsProxy) in touch bar and not enough room to display all items it gets possible to drop a parent bar item to nested bar by replacing inner one. 
Once one does it app crashes with console log:

2017-01-11 18:45:37.342768 touchbartest[786:28851] [General] *** -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds for empty array
2017-01-11 18:45:37.346859 touchbartest[786:28851] [General] (
	0   CoreFoundation                      0x00007fffbb038e7b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffcfc23cad objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffbaf521dc -[__NSArrayM objectAtIndex:] + 204
	3   AppKit                              0x00007fffb95cb3e8 -[NSTouchBarCustomizationPreviewViewController removeItemAtIndex:inSection:reload:] + 62
	4   AppKit                              0x00007fffb95d2ee4 __99-[NSTouchBarCustomizationPreviewViewController(NSInteraction) coordinator:didFinishDrag:isRemoval:]_block_invoke + 673
	5   AppKit                              0x00007fffb95c8ff7 __69-[NSTouchBarCustomizationPreviewViewController updateModel:animated:]_block_invoke + 661
	6   UIFoundation                        0x00007fffcdac369c -[_NSCollectionViewCore _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 210
	7   AppKit                              0x00007fffb94577bf -[NSCollectionView performBatchUpdates:completionHandler:] + 156
	8   AppKit                              0x00007fffb9633424 ___withImplicitAnimationEnabledDo_block_invoke + 52
	9   AppKit                              0x00007fffb9429096 +[NSAnimationContext runAnimationGroup:] + 58
	10  AppKit                              0x00007fffb9632f7b -[_NSViewAnimator_NSCollectionView performBatchUpdates:completionHandler:] + 135
	11  AppKit                              0x00007fffb95c8cd4 -[NSTouchBarCustomizationPreviewViewController updateModel:animated:] + 314
	12  AppKit                              0x00007fffb95d2b16 -[NSTouchBarCustomizationPreviewViewController(NSInteraction) coordinator:didFinishDrag:isRemoval:] + 671
	13  AppKit                              0x00007fffb94b70cc -[NSTouchBarCustomizationPreviewInteractionCoordinator endDragOfItem:isRemoval:] + 333
	14  AppKit                              0x00007fffb95d0c45 -[NSTouchBarCustomizationPreviewViewController(CursorUpdates) cursorMouseUpAtPoint:] + 100
	15  AppKit                              0x00007fffb8eddc79 -[NSTouchBarCustomizationCursorManager updateWithEvent:] + 146
	16  AppKit                              0x00007fffb8eddb2a __59-[NSTouchBarCustomizationCursorManager beginTrackingCursor]_block_invoke + 47
	17  AppKit                              0x00007fffb906ef81 _NSSendEventToDequingObservers + 372
	18  AppKit                              0x00007fffb925aa9f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 869
	19  AppKit                              0x00007fffb8d36d7c -[NSApplication _doModalLoop:peek:] + 497
	20  AppKit                              0x00007fffb8f16f6a __35-[NSApplication runModalForWindow:]_block_invoke + 64
	21  AppKit                              0x00007fffb8d34862 -[NSApplication runModalForWindow:] + 137
	22  AppKit                              0x00007fffb9331224 __82-[NSTouchBarCustomizationController toggleCustomizationPalette:forceControlStrip:]_block_invoke.332 + 177
	23  AppKit                              0x00007fffb93343e6 ___NSMainRunLoopPerformBlockAfterDelay_block_invoke + 25
	24  CoreFoundation                      0x00007fffbafb8244 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
	25  CoreFoundation                      0x00007fffbafb7ecf __CFRunLoopDoTimer + 1071
	26  CoreFoundation                      0x00007fffbafb7a2a __CFRunLoopDoTimers + 298
	27  CoreFoundation                      0x00007fffbafaf3e1 __CFRunLoopRun + 2065
	28  CoreFoundation                      0x00007fffbafae974 CFRunLoopRunSpecific + 420
	29  HIToolbox                           0x00007fffba53aacc RunCurrentEventLoopInMode + 240
	30  HIToolbox                           0x00007fffba53a901 ReceiveNextEventCommon + 432
	31  HIToolbox                           0x00007fffba53a736 _BlockUntilNextEventMatchingListInModeWithFilter + 71
	32  AppKit                              0x00007fffb8ae0ae4 _DPSNextEvent + 1120
	33  AppKit                              0x00007fffb925b21f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
	34  AppKit                              0x00007fffb8ad5465 -[NSApplication run] + 926
	35  AppKit                              0x00007fffb8a9fd80 NSApplicationMain + 1237
	36  touchbartest                        0x00000001000016e2 main + 34
	37  libdyld.dylib                       0x00007fffd0507255 start + 1
	38  ???                                 0x0000000000000003 0x0 + 3
)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!