FuzzyAutocomplete / FuzzyAutocompletePlugin

A Xcode 5+ plugin that adds more flexible autocompletion rather than just prefix-matching.
MIT License
3.25k stars 353 forks source link

Fuzz crahes XCode 7 #92

Open achernoprudov opened 9 years ago

achernoprudov commented 9 years ago

When I'm trying to correct a misspelled word by deleting with backspace Fuzz crashes my XCode 7. Here is some part of crashreport.

Process:               Xcode [23822]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               7.0 (8227)
Build Info:            IDEFrameworks-8227000000000000~2
App Item ID:           497799835
App External ID:       813293765
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [23822]
User ID:               501

PlugIn Path:             /Users/USER/Library/Application Support/Developer/*/FuzzyAutocomplete
PlugIn Identifier:       io.github.FuzzyAutocomplete
PlugIn Version:          2.1.1 (2.1.1)

Application Specific Information:
ProductBuildVersion: 7A220
UNCAUGHT EXCEPTION (NSRangeException): NSMutableRLEArray objectAtIndex:effectiveRange:runIndex:: Out of bounds
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff949bb024 __exceptionPreprocess (in CoreFoundation)
  1  0x000000010d39c744 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2  0x00007fff88aed76e objc_exception_throw (in libobjc.A.dylib)
  3  0x00007fff949baeed +[NSException raise:format:] (in CoreFoundation)
  4  0x00007fff95f492f8 -[NSRLEArray objectAtIndex:effectiveRange:runIndex:] (in Foundation)
  5  0x00007fff95f490ab -[NSConcreteMutableAttributedString attribute:atIndex:longestEffectiveRange:inRange:] (in Foundation)
  6  0x000000010d9fe317 -[DVTTextStorage(DVTTextStorageMRR) attribute:atIndex:longestEffectiveRange:inRange:] (in DVTKit)
  7  0x00007fff92abdef0 -[NSLayoutManager(NSPrivate) _drawBackgroundForGlyphRange:atPoint:] (in UIFoundation)
  8  0x000000010d8854cb -[DVTLayoutManager drawBackgroundForGlyphRange:atPoint:] (in DVTKit)
  9  0x00007fff93d7f6b5 -[NSTextView drawRect:] (in AppKit)
 10  0x000000010d884154 -[DVTCompletingTextView drawRect:] (in DVTKit)
 11  0x000000010d883df4 -[DVTSourceTextView drawRect:] (in DVTKit)
 12  0x00007fff93d39749 -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:] (in AppKit)
 13  0x00007fff93d39168 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke (in AppKit)
 14  0x00007fff93d38e11 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] (in AppKit)
 15  0x00007fff93d38493 -[NSView(NSLayerKitGlue) drawLayer:inContext:] (in AppKit)
 16  0x00007fff93fb6c42 -[NSTextView drawLayer:inContext:] (in AppKit)
 17  0x00007fff8aa443c7 CABackingStoreUpdate_ (in QuartzCore)
 18  0x00007fff8aa436d7 ___ZN2CA5Layer8display_Ev_block_invoke (in QuartzCore)
 19  0x00007fff8aa43694 x_blame_allocations (in QuartzCore)
 20  0x00007fff8aa3743c CA::Layer::display_() (in QuartzCore)
 21  0x00007fff93ca442b _NSBackingLayerDisplay (in AppKit)
 22  0x00007fff93ca1026 -[_NSViewBackingLayer display] (in AppKit)
 23  0x00007fff93fb6b85 -[_NSTextViewBackingLayer display] (in AppKit)
 24  0x00007fff8aa357fd CA::Layer::display_if_needed(CA::Transaction*) (in QuartzCore)
 25  0x00007fff8aa34e81 CA::Layer::layout_and_display_if_needed(CA::Transaction*) (in QuartzCore)
 26  0x00007fff8aa34612 CA::Context::commit_transaction(CA::Transaction*) (in QuartzCore)
 27  0x00007fff8aa343ae CA::Transaction::commit() (in QuartzCore)
 28  0x00007fff93d119d6 -[NSWindow _setFrameCommon:display:stashSize:] (in AppKit)
 29  0x000000010da42f7d -[DVTTextCompletionListWindowController _updateCurrentDisplayState] (in DVTKit)
 30  0x000000011d6cd53b
 31  0x000000010da3fe24 __82-[DVTTextCompletionListWindowController showWindowForTextFrame:explicitAnimation:]_block_invoke (in DVTKit)
 32  0x000000010d3aeac4 __95-[NSObject(DVTObservingConvenience) _dvt_newObserverForKeyPath:options:owner:withHandlerBlock:]_block_invoke (in DVTFoundation)
 33  0x000000010d3add86 __73-[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:]_block_invoke183 (in DVTFoundation)
 34  0x000000010d319c6f DVTInvokeWithStrongOwnership (in DVTFoundation)
 35  0x000000010d17e1ff -[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:] (in DVTFoundation)
 36  0x00007fff95f511c3 NSKeyValueNotifyObserver (in Foundation)
 37  0x00007fff95f5de38 NSKeyValueDidChange (in Foundation)
 38  0x00007fff95f16a4d -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] (in Foundation)
 39  0x000000011d6c417b
 40  0x000000010d8b108a -[DVTTextCompletionSession setCursorLocation:] (in DVTKit)
 41  0x000000010d84f609 -[DVTTextCompletionController textViewSelectionChanging] (in DVTKit)
 42  0x000000010d84f532 -[DVTCompletingTextView setSelectedRanges:affinity:stillSelecting:] (in DVTKit)
 43  0x000000010d875d1f -[DVTSourceTextView setSelectedRanges:affinity:stillSelecting:] (in DVTKit)
 44  0x000000010d84f422 -[DVTCompletingTextView setSelectedRange:] (in DVTKit)
 45  0x000000010d875bac -[DVTSourceTextView setSelectedRange:] (in DVTKit)
 46  0x00007fff9606a174 _NSSetRangeValueAndNotify (in Foundation)
 47  0x00007fff92a053af -[NSLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] (in UIFoundation)
 48  0x000000010d9d83d6 -[DVTFoldingLayoutManager textStorage:edited:range:changeInLength:invalidatedRange:] (in DVTKit)
 49  0x00007fff92a27291 -[NSTextStorage _notifyEdited:range:changeInLength:invalidatedRange:] (in UIFoundation)
 50  0x00007fff92a26d93 -[NSTextStorage processEditing] (in UIFoundation)
 51  0x000000010d85a4db -[DVTTextStorage processEditing] (in DVTKit)
 52  0x00007fff92a26a61 -[NSTextStorage endEditing] (in UIFoundation)
 53  0x000000010d85a19d -[DVTTextStorage endEditing] (in DVTKit)
 54  0x000000010d998b0a -[DVTTextStorage replaceCharactersInRange:withString:evenIfNotEditable:] (in DVTKit)
 55  0x00007fff93feaaf1 -[NSTextView(NSPrivate) _userReplaceRange:withString:] (in AppKit)
 56  0x00007fff93fea48b _NSDoUserReplaceForCharRange (in AppKit)
 57  0x00007fff93fea2a6 _NSDoUserDeleteForCharRange (in AppKit)
 58  0x00007fff9406ec36 -[NSTextView(NSKeyBindingCommands) deleteBackward:] (in AppKit)
 59  0x000000010daa3390 -[DVTCompletingTextView deleteBackward:] (in DVTKit)
 60  0x000000010d8bbb9a -[DVTSourceTextView deleteBackward:] (in DVTKit)
 61  0x00007fff93f39ef1 -[NSTextView doCommandBySelector:] (in AppKit)
 62  0x000000010d8b7d5c -[DVTCompletingTextView doCommandBySelector:] (in DVTKit)
 63  0x00007fff93f39e01 -[NSTextInputContext(NSInputContext_WithCompletion) doCommandBySelector:completionHandler:] (in AppKit)
 64  0x00007fff93f1fc23 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] (in AppKit)
 65  0x00007fff944e6272 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke972 (in AppKit)
 66  0x00007fff93f21bff -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] (in AppKit)
 67  0x00007fff93f39d03 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke_3 (in AppKit)
 68  0x00007fff93f32ed8 -[NSTextInputContext tryHandleEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] (in AppKit)
 69  0x00007fff944e6074 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke960 (in AppKit)
 70  0x00007fff8d329d4f __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_5 (in HIToolbox)
 71  0x00007fff8d328c45 ___ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec_block_invoke (in HIToolbox)
 72  0x00007fff93f22606 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke174 (in AppKit)
 73  0x00007fff93f21bff -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] (in AppKit)
 74  0x00007fff93f21ba0 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 (in AppKit)
 75  0x00007fff93f21b18 -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] (in AppKit)
 76  0x00007fff93f217d5 -[NSTextInputContext handleTSMEvent:completionHandler:] (in AppKit)
 77  0x00007fff93f20b2e _NSTSMEventHandler (in AppKit)
 78  0x00007fff8d2c2b6c DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) (in HIToolbox)
 79  0x00007fff8d2c1fae SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) (in HIToolbox)
 80  0x00007fff8d2c1e22 SendEventToEventTargetWithOptions (in HIToolbox)
 81  0x00007fff8d32626c SendTSMEvent_WithCompletionHandler (in HIToolbox)
 82  0x00007fff8d32676c __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke (in HIToolbox)
 83  0x00007fff8d3265a6 __SendFilterTextEvent_WithCompletionHandler_block_invoke (in HIToolbox)
 84  0x00007fff8d3262c0 SendTSMEvent_WithCompletionHandler (in HIToolbox)
 85  0x00007fff8d32608f SendFilterTextEvent_WithCompletionHandler (in HIToolbox)
 86  0x00007fff8d325d51 SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler (in HIToolbox)
 87  0x00007fff8d325ae9 __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 (in HIToolbox)
 88  0x00007fff8d325988 __utDeliverTSMEvent_WithCompletionHandler_block_invoke (in HIToolbox)
 89  0x00007fff8d3257cd TSMKeyEvent_WithCompletionHandler (in HIToolbox)
 90  0x00007fff8d3254d0 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 (in HIToolbox)
 91  0x00007fff8d325386 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 (in HIToolbox)
 92  0x00007fff8d325112 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 (in HIToolbox)
 93  0x00007fff8d324f25 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke (in HIToolbox)
 94  0x00007fff8d30976f TSMProcessRawKeyEventWithOptionsAndCompletionHandler (in HIToolbox)
 95  0x00007fff944e5e86 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke949 (in AppKit)
 96  0x00007fff93f1f352 -[NSTextInputContext tryTSMProcessRawKeyEvent:dispatchCondition:setupForDispatch:furtherCondition:dispatchWork:continuation:] (in AppKit)
 97  0x00007fff93f1f085 -[NSTextInputContext _handleEvent:options:completionHandler:] (in AppKit)
 98  0x00007fff93f1eb4e -[NSTextInputContext handleEvent:] (in AppKit)
 99  0x00007fff93f1ea54 -[NSView interpretKeyEvents:] (in AppKit)
100  0x00007fff93f1e86a -[NSTextView keyDown:] (in AppKit)
101  0x00007fff9440e0fb -[NSWindow _reallySendEvent:isDelayedEvent:] (in AppKit)
102  0x00007fff93d9fc86 -[NSWindow sendEvent:] (in AppKit)
103  0x000000010e7f631e -[IDEWorkspaceWindow sendEvent:] (in IDEKit)
104  0x00007fff93d9c8b1 -[NSApplication sendEvent:] (in AppKit)
105  0x000000010e5acae9 -[IDEApplication sendEvent:] (in IDEKit)
106  0x00007fff93cc5b68 -[NSApplication run] (in AppKit)
107  0x00007fff93c42244 NSApplicationMain (in AppKit)
108  0x00007fff91f145c9 start (in libdyld.dylib)
egold commented 9 years ago

+1 was just about to come report same crash, same out-of-bounds error (NSMutableRLEArray objectAtIndex:effectiveRange:runIndex:: Out of bounds)

egold commented 9 years ago

I believe crash happens in this method: https://github.com/FuzzyAutocomplete/FuzzyAutocompletePlugin/blob/master/FuzzyAutocomplete/DVTTextCompletionListWindowController%2BFuzzyAutocomplete.m#L121

egold commented 9 years ago

Interestingly, after removing FuzzyAutoComplete, base Xcode autocomplete crashes when backspacing past the 5th character. I think this may be an Xcode 7 issue, not FAC's issue.

http://stackoverflow.com/questions/32070483/xcode-7-beta-crash-on-autocompletion-nsrangeexception

https://forums.developer.apple.com/thread/14832

egold commented 9 years ago

This might be coincidental, but I noticed if I typed a few characters like [super viewDidL and wait a few seconds, the crash hasn't happened since. Maybe Xcode is lazy-building some index for autocomplete? Fingers crossed...

Brok3nHalo commented 9 years ago

Do you guys happen to have SCXcodeMiniMap installed as well?

I had this same crash and removing FuzzyAutoComplete also didn't help, but then someone I work with had the same issue and we only had two overlapping plugins and Fuzzy wasn't one of them. After uninstalling MiniMap I re-installed FuzzyAutoCOmplete and haven't had crash in over an hour.

virusman commented 9 years ago

@Brok3nHalo Thanks!! Removing SCXcodeMiniMap has solved the issue for me.

saltwat5r commented 9 years ago

I've just removed SCXcodeMiniMap, but this not resolved problem.

yuzupup commented 9 years ago

+1 to experiencing this. Not sure of the exact circumstances... I've since turned Fuzzy off because when it crashes, I lose work :(

egold commented 9 years ago

It's a problem with vanilla Xcode too. Even after completely removing Alcatraz, I still get this crash. The workaround I'm using is to set Xcode prefs to not use autocomplete except when I press the Esc key. So lame.

BillZong commented 9 years ago

@Brok3nHalo Thanks a lot. It confuse me some how until I remove the SCXcodeMiniMap.

yuyao110120 commented 9 years ago

Hide MiniMap has solved the issue for me.

slazyk commented 9 years ago

Is this still happening in 7.1? If yes, does removing SCXcodeMiniMap help?