NSTextView is unusable
Originator: | tom | ||
Number: | rdar://28525231 | Date Originated: | |
Status: | Open | Resolved: | |
Product: | macOS SDK | Product Version: | macOS 10.12 (16A323) |
Classification: | Serious | Reproducible: | Always |
Summary: Following on from 28222511 Ultimately, I need to be able to create my own instance of NSTextStorage for use in an NSTextView created via interface builder. Steps to Reproduce: Run the attached project. Type multiple lines of text. Use the arrow keys to move to the top of the document. Type some more text. Expected Results: Should be able to type into the text view as normal Actual Results: Text in the text view is totally messed up! Please see the attached video for more details. After a while, the application will crash with the following stack trace. Exception Name: NSInternalInconsistencyException Description: -[NSLayoutManager _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] *** attempted glyph generation while textStorage is editing. It is not valid to cause the layoutManager to do glyph generation while the textStorage is editing (ie the textStorage has been sent a beginEditing message without a matching endEditing.) User Info: (null) 0 CoreFoundation 0x00007fff9b3c052b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fffafa98cad objc_exception_throw + 48 2 CoreFoundation 0x00007fff9b43ea0d +[NSException raise:format:] + 205 3 UIFoundation 0x00007fffad9fa328 -[NSLayoutManager(NSPrivate) _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] + 492 4 UIFoundation 0x00007fffad9fcdbe _NSFastFillAllGlyphHolesForCharacterRange + 735 5 UIFoundation 0x00007fffad917359 -[NSLayoutManager glyphRangeForCharacterRange:actualCharacterRange:] + 64 6 AppKit 0x00007fff9916a54c -[NSTextView(NSPrivate) _scrollRangeToVisible:forceCenter:] + 1164 7 UIFoundation 0x00007fffada018be -[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] + 7247 8 UIFoundation 0x00007fffad9ffb30 -[NSLayoutManager(NSPrivate) _recalculateUsageForTextContainerAtIndex:] + 2757 9 UIFoundation 0x00007fffad90faed _enableTextViewResizing + 231 10 UIFoundation 0x00007fffad913b3c -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] + 569 11 UIFoundation 0x00007fffad913b90 -[NSLayoutManager processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:] + 47 12 UIFoundation 0x00007fffad964585 -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] + 178 13 UIFoundation 0x00007fffad964037 -[NSTextStorage processEditing] + 373 14 UIFoundation 0x00007fffad963c4d -[NSTextStorage endEditing] + 111 15 AppKit 0x00007fff991660b4 -[NSTextView insertText:replacementRange:] + 2996 16 AppKit 0x00007fff99165080 -[NSTextInputContext(NSInputContext_WithCompletion) insertText:replacementRange:completionHandler:] + 79 17 AppKit 0x00007fff998ff75b __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2.225 + 108 18 AppKit 0x00007fff99165029 -[NSTextInputContext do_HandleTSMEvent_insertFixLenTextLoop:whileCondition:dispatchWorkEach:afterEachInsertText:continuation:] + 111 19 AppKit 0x00007fff998fd601 -[NSTextInputContext tryHandleTSMEvent_insertFixLenText_withContext:dispatchCondition:setupForDispatch:nestedWorkaroundCondition:nestedWorkaroundDispatchWork:loopCondition:dispatchWorkEach:afterEachInsertText:continuation:] + 387 20 AppKit 0x00007fff998ff32f __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke.157 + 4105 21 AppKit 0x00007fff99164ca9 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 + 80 22 AppKit 0x00007fff99164c29 -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] + 93 23 AppKit 0x00007fff99164618 -[NSTextInputContext handleTSMEvent:completionHandler:] + 2221 24 AppKit 0x00007fff99163cfd _NSTSMEventHandler + 319 25 HIToolbox 0x00007fff9a8b00d5 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1708 26 HIToolbox 0x00007fff9a8af346 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 428 27 HIToolbox 0x00007fff9a8af18f SendEventToEventTargetWithOptions + 43 28 HIToolbox 0x00007fff9a905f86 SendTSMEvent_WithCompletionHandler + 408 29 HIToolbox 0x00007fff9a906460 __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke + 400 30 HIToolbox 0x00007fff9a9062c1 __SendFilterTextEvent_WithCompletionHandler_block_invoke + 215 31 HIToolbox 0x00007fff9a905fd7 SendTSMEvent_WithCompletionHandler + 489 32 HIToolbox 0x00007fff9a905dc1 SendFilterTextEvent_WithCompletionHandler + 236 33 HIToolbox 0x00007fff9a905a82 SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler + 284 34 HIToolbox 0x00007fff9a905838 __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 + 296 35 HIToolbox 0x00007fff9a9056de __utDeliverTSMEvent_WithCompletionHandler_block_invoke + 439 36 HIToolbox 0x00007fff9a9054a4 TSMKeyEvent_WithCompletionHandler + 632 37 HIToolbox 0x00007fff9a9051f3 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 + 251 38 HIToolbox 0x00007fff9a905020 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 + 281 39 HIToolbox 0x00007fff9a904d36 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 + 308 40 HIToolbox 0x00007fff9a904a6d __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke + 300 41 HIToolbox 0x00007fff9a903fdd TSMProcessRawKeyEventWithOptionsAndCompletionHandler + 3604 42 AppKit 0x00007fff99904f16 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke.885 + 116 43 AppKit 0x00007fff999049c5 __204-[NSTextInputContext tryTSMProcessRawKeyEvent_orSubstitution:dispatchCondition:setupForDispatch:furtherCondition:doubleSpaceSubstitutionCondition:doubleSpaceSubstitutionWork:dispatchTSMWork:continuation:]_block_invoke.817 + 121 44 AppKit 0x00007fff9990482f -[NSTextInputContext tryTSMProcessRawKeyEvent_orSubstitution:dispatchCondition:setupForDispatch:furtherCondition:doubleSpaceSubstitutionCondition:doubleSpaceSubstitutionWork:dispatchTSMWork:continuation:] + 285 45 AppKit 0x00007fff991625fb -[NSTextInputContext _handleEvent:options:completionHandler:] + 1298 46 AppKit 0x00007fff991620ae -[NSTextInputContext handleEvent:] + 109 47 AppKit 0x00007fff99161fb2 -[NSView interpretKeyEvents:] + 232 48 AppKit 0x00007fff99161dc9 -[NSTextView keyDown:] + 704 49 AppKit 0x00007fff9983d7ec -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 4086 50 AppKit 0x00007fff9983c42a -[NSWindow(NSEventRouting) sendEvent:] + 541 51 AppKit 0x00007fff996dda1c -[NSApplication(NSEvent) sendEvent:] + 4768 52 AppKit 0x00007fff98fc3009 -[NSApplication run] + 1002 53 AppKit 0x00007fff98f8da8a NSApplicationMain + 1237 54 TextViewContainer 0x0000000100001ea2 main + 34 55 libdyld.dylib 0x00007fffb0376255 start + 1 Version: macOS 10.12 (16A323) Xcode 8.0 (8A218a) Attachments: 'TextViewContainer.zip' and 'NSTextView Crash.mov' were successfully uploaded.
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!