Skip to content

Commit

Permalink
Merge pull request #4936 from SimonSiefke/fix/memory-leak
Browse files Browse the repository at this point in the history
fix: memory leak in CoreBrowserService
  • Loading branch information
Tyriar committed Apr 21, 2024
2 parents 6be1c3f + af8a663 commit 499afa1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/browser/services/CoreBrowserService.ts
Expand Up @@ -13,7 +13,7 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic

private _isFocused = false;
private _cachedIsFocused: boolean | undefined = undefined;
private _screenDprMonitor = new ScreenDprMonitor(this._window);
private _screenDprMonitor = this.register(new ScreenDprMonitor(this._window));

private readonly _onDprChange = this.register(new EventEmitter<number>());
public readonly onDprChange = this._onDprChange.event;
Expand All @@ -31,8 +31,12 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
this.register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
this.register(forwardEvent(this._screenDprMonitor.onDprChange, this._onDprChange));

this._textarea.addEventListener('focus', () => this._isFocused = true);
this._textarea.addEventListener('blur', () => this._isFocused = false);
this.register(
addDisposableDomListener(this._textarea, 'focus', () => (this._isFocused = true))
);
this.register(
addDisposableDomListener(this._textarea, 'blur', () => (this._isFocused = false))
);
}

public get window(): Window & typeof globalThis {
Expand Down

0 comments on commit 499afa1

Please sign in to comment.