mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't throw exceptions when using editor APIs after destroying the editor
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
79e68b462d
commit
6f13159549
@@ -26,7 +26,6 @@ class Cursor extends Model
|
||||
|
||||
destroy: ->
|
||||
@marker.destroy()
|
||||
@marker = null
|
||||
|
||||
###
|
||||
Section: Event Subscription
|
||||
|
||||
@@ -26,8 +26,6 @@ class Selection extends Model
|
||||
|
||||
destroy: ->
|
||||
@marker.destroy()
|
||||
@marker = null
|
||||
@decoration = null
|
||||
|
||||
isLastSelection: ->
|
||||
this is @editor.getLastSelection()
|
||||
|
||||
@@ -409,24 +409,14 @@ class TextEditor extends Model
|
||||
|
||||
destroyed: ->
|
||||
@emitter.emit 'did-destroy'
|
||||
@emitter = null
|
||||
@emitter.clear()
|
||||
@disposables.dispose()
|
||||
@displayLayer.destroy()
|
||||
@displayLayer = null
|
||||
@defaultMarkerLayer = null
|
||||
@tokenizedBuffer.destroy()
|
||||
@tokenizedBuffer = null
|
||||
selection.destroy() for selection in @selections.slice()
|
||||
@selections = null
|
||||
@cursors = null
|
||||
@selectionsMarkerLayer = null
|
||||
@buffer.release()
|
||||
@buffer = null
|
||||
@decorationManager = null
|
||||
@languageMode.destroy()
|
||||
@languageMode = null
|
||||
@gutterContainer.destroy()
|
||||
@gutterContainer = null
|
||||
@editorElement = null
|
||||
@presenter = null
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class TokenizedBuffer extends Model
|
||||
|
||||
destroyed: ->
|
||||
@disposables.dispose()
|
||||
@tokenizedLines.length = 0
|
||||
|
||||
buildIterator: ->
|
||||
new TokenizedBufferIterator(this)
|
||||
@@ -94,6 +95,7 @@ class TokenizedBuffer extends Model
|
||||
false
|
||||
|
||||
retokenizeLines: ->
|
||||
return unless @alive
|
||||
@fullyTokenized = false
|
||||
@tokenizedLines = new Array(@buffer.getLineCount())
|
||||
@invalidRows = []
|
||||
|
||||
Reference in New Issue
Block a user