diff options
author | Alexandru Dima <alexdima@microsoft.com> | 2022-05-10 16:08:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-10 16:08:07 +0300 |
commit | ae7d4f417abb6d7b72b52df1f73bce9a8adef9ae (patch) | |
tree | 3e7f600697fe0f396a7c26fb947c14d9bfdc6338 | |
parent | 14feeed565aaadce2eede2a1c86d42aab58705ed (diff) |
Fixes #148893: Use the change accessor pattern to avoid leaking decorations via `deltaDecorations` (#149161)
-rw-r--r-- | src/vs/editor/contrib/multicursor/browser/multicursor.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vs/editor/contrib/multicursor/browser/multicursor.ts b/src/vs/editor/contrib/multicursor/browser/multicursor.ts index 7c658f0fa9b..27c7f171adf 100644 --- a/src/vs/editor/contrib/multicursor/browser/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/browser/multicursor.ts @@ -986,7 +986,9 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut this.state = newState; if (!this.state) { - this.decorations = this.editor.deltaDecorations(this.decorations, []); + this.editor.changeDecorations((accessor) => { + this.decorations = accessor.deltaDecorations(this.decorations, []); + }); return; } @@ -1042,7 +1044,9 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut }; }); - this.decorations = this.editor.deltaDecorations(this.decorations, decorations); + this.editor.changeDecorations((accessor) => { + this.decorations = accessor.deltaDecorations(this.decorations, decorations); + }); } private static readonly _SELECTION_HIGHLIGHT_OVERVIEW = ModelDecorationOptions.register({ |