debt - fix some leaks found by copilot (#293685)

This commit is contained in:
Benjamin Pasero
2026-02-07 20:38:58 +01:00
committed by GitHub
parent efb6eeee9d
commit a4b17ff67a
6 changed files with 23 additions and 21 deletions

View File

@@ -5,7 +5,7 @@
import { getWindowId, onDidUnregisterWindow } from './dom.js';
import { Emitter, Event } from '../common/event.js';
import { Disposable, markAsSingleton } from '../common/lifecycle.js';
import { Disposable, markAsSingleton, toDisposable } from '../common/lifecycle.js';
type BackingStoreContext = CanvasRenderingContext2D & {
webkitBackingStorePixelRatio?: number;
@@ -32,6 +32,8 @@ class DevicePixelRatioMonitor extends Disposable {
this._listener = () => this._handleChange(targetWindow, true);
this._mediaQueryList = null;
this._handleChange(targetWindow, false);
this._register(toDisposable(() => this._mediaQueryList?.removeEventListener('change', this._listener)));
}
private _handleChange(targetWindow: Window, fireEvent: boolean): void {