Skip to content

Commit a2067fe

Browse files
SimonSiefkebpasero
andauthored
fix: memory leak in sticky scroll (microsoft#271102)
* fix: memory leak in sticky scroll * simplify --------- Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
1 parent 443cc8e commit a2067fe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const STICKY_IS_FOLDING_ICON_ATTR = 'data-sticky-is-folding-icon';
5151

5252
export class StickyScrollWidget extends Disposable implements IOverlayWidget {
5353

54-
private readonly _foldingIconStore = new DisposableStore();
54+
private readonly _foldingIconStore = this._register(new DisposableStore());
5555
private readonly _rootDomNode: HTMLElement = document.createElement('div');
5656
private readonly _lineNumbersDomNode: HTMLElement = document.createElement('div');
5757
private readonly _linesDomNodeScrollable: HTMLElement = document.createElement('div');
@@ -118,7 +118,6 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
118118
updateScrollLeftPosition();
119119
this._updateWidgetWidth();
120120
}));
121-
this._register(this._foldingIconStore);
122121
updateScrollLeftPosition();
123122

124123
this._register(this._editor.onDidLayoutChange((e) => {
@@ -283,6 +282,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
283282
if (showFoldingControls !== 'mouseover') {
284283
return;
285284
}
285+
this._foldingIconStore.clear();
286286
this._foldingIconStore.add(dom.addDisposableListener(this._lineNumbersDomNode, dom.EventType.MOUSE_ENTER, () => {
287287
this._isOnGlyphMargin = true;
288288
this._setFoldingIconsVisibility(true);

0 commit comments

Comments
 (0)