disable document changes during batch folding update and add bounds-checking assertions to EditorSizeManager (to prevent EA-82327)

This commit is contained in:
Dmitry Batrak
2017-05-02 15:46:35 +03:00
parent 4a7f75c4d3
commit 6515c83446
2 changed files with 3 additions and 0 deletions
@@ -561,6 +561,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedInternalDocu
@Override
public void beforeDocumentChange(DocumentEvent event) {
if (myIsBatchFoldingProcessing) LOG.error("Document changes are not allowed during batch folding update");
myDocumentChangeProcessed = false;
}
@@ -378,6 +378,8 @@ class EditorSizeManager extends InlayModel.SimpleAdapter implements PrioritizedD
}
void textLayoutPerformed(int startOffset, int endOffset) {
assert 0 <= startOffset && startOffset < endOffset && endOffset <= myDocument.getTextLength()
: "startOffset=" + startOffset + ", endOffset=" + endOffset;
if (myDocument.isInBulkUpdate()) return;
if (myEditor.getFoldingModel().isInBatchFoldingOperation()) {
myDeferredRanges.add(new TextRange(startOffset, endOffset));