Merge pull request #7320 from atom/as-remove-gutter-from-view-registry

Fix TextEditorComponent Race Condition
This commit is contained in:
Antonio Scandurra
2015-06-19 09:01:59 +02:00
2 changed files with 10 additions and 1 deletions

View File

@@ -67,6 +67,15 @@ describe "TextEditorComponent", ->
expect(nextAnimationFrame).not.toThrow()
it "doesn't update when an animation frame was requested but the component got destroyed before its delivery", ->
editor.setText("You shouldn't see this update.")
expect(nextAnimationFrame).not.toBe(noAnimationFrame)
component.destroy()
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).not.toBe("You shouldn't see this update.")
describe "line rendering", ->
expectTileContainsRow = (tileNode, screenRow, {top}) ->
lineNode = tileNode.querySelector("[data-screen-row='#{screenRow}']")

View File

@@ -195,7 +195,7 @@ class TextEditorComponent
@updateRequested = true
atom.views.updateDocument =>
@updateRequested = false
@updateSync() if @editor.isAlive()
@updateSync() if @canUpdate()
atom.views.readDocument(@readAfterUpdateSync)
canUpdate: ->