From 5732ff39ed91b7b35f2ba77c4bc4fa4ad79d7f10 Mon Sep 17 00:00:00 2001 From: Simon Siefke Date: Mon, 24 Nov 2025 01:22:16 +0100 Subject: [PATCH] fix: memory leak in task problem monitor --- .../workbench/contrib/tasks/browser/taskProblemMonitor.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/tasks/browser/taskProblemMonitor.ts b/src/vs/workbench/contrib/tasks/browser/taskProblemMonitor.ts index 020a8adc5c308..8b8486c34915f 100644 --- a/src/vs/workbench/contrib/tasks/browser/taskProblemMonitor.ts +++ b/src/vs/workbench/contrib/tasks/browser/taskProblemMonitor.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js'; +import { Disposable, DisposableMap, DisposableStore } from '../../../../base/common/lifecycle.js'; import { AbstractProblemCollector } from '../common/problemCollectors.js'; import { ITerminalInstance } from '../../terminal/browser/terminal.js'; import { URI } from '../../../../base/common/uri.js'; @@ -17,7 +17,7 @@ interface ITerminalMarkerData { export class TaskProblemMonitor extends Disposable { private readonly terminalMarkerMap: Map = new Map(); - private readonly terminalDisposables: Map = new Map(); + private readonly terminalDisposables = new DisposableMap(); constructor() { super(); @@ -34,8 +34,7 @@ export class TaskProblemMonitor extends Disposable { store.add(terminal.onDisposed(() => { this.terminalMarkerMap.delete(terminal.instanceId); - this.terminalDisposables.get(terminal.instanceId)?.dispose(); - this.terminalDisposables.delete(terminal.instanceId); + this.terminalDisposables.deleteAndDispose(terminal.instanceId); })); store.add(problemMatcher.onDidFindErrors((markers: ITaskMarker[]) => {