diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 9147bc21a..0ad43046b 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -5060,11 +5060,12 @@ describe "TextEditor", -> expect(coffeeEditor.lineTextForBufferRow(2)).toBe "" describe ".destroy()", -> - it "destroys all markers associated with the edit session", -> - editor.foldAll() - expect(buffer.getMarkerCount()).toBeGreaterThan 0 + it "destroys marker layers associated with the text editor", -> + selectionsMarkerLayerId = editor.selectionsMarkerLayer.id + foldsMarkerLayerId = editor.displayBuffer.foldsMarkerLayer.id editor.destroy() - expect(buffer.getMarkerCount()).toBe 0 + expect(buffer.getMarkerLayer(selectionsMarkerLayerId)).toBeUndefined() + expect(buffer.getMarkerLayer(foldsMarkerLayerId)).toBeUndefined() it "notifies ::onDidDestroy observers when the editor is destroyed", -> destroyObserverCalled = false diff --git a/src/text-editor.coffee b/src/text-editor.coffee index dc8de4b0a..da077ae2b 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -181,6 +181,7 @@ class TextEditor extends Model @disposables.dispose() @tabTypeSubscription.dispose() selection.destroy() for selection in @selections.slice() + @selectionsMarkerLayer.destroy() @buffer.release() @displayBuffer.destroy() @languageMode.destroy()