🐛 Ignore setting dimensions for destroyed decorations

This commit is contained in:
Antonio Scandurra
2016-01-05 10:56:29 +01:00
parent 0d28018127
commit c7a7f0c6dd
2 changed files with 11 additions and 0 deletions

View File

@@ -2375,6 +2375,15 @@ describe "TextEditorPresenter", ->
isVisible: true
}
it "doesn't throw an error when setting the dimensions for a destroyed decoration", ->
blockDecoration = addBlockDecorationForScreenRow(0)
presenter = buildPresenter(explicitHeight: 30, lineHeight: 10, tileSize: 2, scrollTop: 0)
blockDecoration.destroy()
presenter.setBlockDecorationDimensions(blockDecoration, 30, 30)
expect(getState(presenter).content.blockDecorations).toEqual({})
describe ".overlays", ->
[item] = []
stateForOverlay = (presenter, decoration) ->

View File

@@ -1270,6 +1270,8 @@ class TextEditorPresenter
@emitDidUpdateState()
setBlockDecorationDimensions: (decoration, width, height) ->
return unless @observedBlockDecorations.has(decoration)
@lineTopIndex.resizeBlock(decoration.getId(), height)
@invalidatedDimensionsByBlockDecoration.delete(decoration)