mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Reduce the impact of leaking Editor, Selection, & Cursor objects
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
26b128dd46
commit
d0d187f36a
@@ -26,6 +26,7 @@ class Cursor extends Model
|
||||
|
||||
destroy: ->
|
||||
@marker.destroy()
|
||||
@marker = null
|
||||
|
||||
###
|
||||
Section: Event Subscription
|
||||
|
||||
@@ -26,6 +26,8 @@ class Selection extends Model
|
||||
|
||||
destroy: ->
|
||||
@marker.destroy()
|
||||
@marker = null
|
||||
@decoration = null
|
||||
|
||||
isLastSelection: ->
|
||||
this is @editor.getLastSelection()
|
||||
|
||||
@@ -408,16 +408,27 @@ class TextEditor extends Model
|
||||
@emitter.emit 'did-change', {}
|
||||
|
||||
destroyed: ->
|
||||
@emitter.emit 'did-destroy'
|
||||
@emitter = null
|
||||
@disposables.dispose()
|
||||
@displayLayer.destroy()
|
||||
@disposables.dispose()
|
||||
@displayLayer = null
|
||||
@defaultMarkerLayer = null
|
||||
@tokenizedBuffer.destroy()
|
||||
@tokenizedBuffer = null
|
||||
selection.destroy() for selection in @selections.slice()
|
||||
@selectionsMarkerLayer.destroy()
|
||||
@selections = null
|
||||
@cursors = null
|
||||
@selectionsMarkerLayer = null
|
||||
@buffer.release()
|
||||
@buffer = null
|
||||
@decorationManager = null
|
||||
@languageMode.destroy()
|
||||
@languageMode = null
|
||||
@gutterContainer.destroy()
|
||||
@emitter.emit 'did-destroy'
|
||||
@gutterContainer = null
|
||||
@editorElement = null
|
||||
@presenter = null
|
||||
|
||||
###
|
||||
Section: Event Subscription
|
||||
|
||||
Reference in New Issue
Block a user