From f58fd749aaabe4851f50e2d02436db815a699449 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 May 2017 18:30:44 +0200 Subject: [PATCH] Dispose nodes associated with a LineComponent when replacing it --- src/text-editor-component.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index da62af98c..fe3eb15c3 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -3453,12 +3453,7 @@ class LinesTileComponent { textNodesByScreenLineId }) this.element.insertBefore(newScreenLineComponent.element, oldScreenLineComponent.element) - // Instead of calling destroy on the component here we can simply - // remove its associated element, thus skipping the - // lineNodesByScreenLineId bookkeeping. This is possible because - // lineNodesByScreenLineId has already been updated when creating the - // new screen line component. - oldScreenLineComponent.element.remove() + oldScreenLineComponent.destroy() this.lineComponents[lineComponentIndex] = newScreenLineComponent oldScreenLineIndex++