From d15b5fba816292582afb72bc7e2cf7f55aa514fe Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 20 Sep 2023 09:39:12 -0700 Subject: [PATCH] Clear parent on leak --- src/vs/base/common/lifecycle.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/base/common/lifecycle.ts b/src/vs/base/common/lifecycle.ts index 55687fc6934..de7b5d15e6e 100644 --- a/src/vs/base/common/lifecycle.ts +++ b/src/vs/base/common/lifecycle.ts @@ -446,11 +446,17 @@ export class DisposableStore implements IDisposable { o.dispose(); } + /** + * Deletes the value from the store, but does not dispose it. + */ public deleteAndLeak(o: T): void { if (!o) { return; } - this._toDispose.delete(o); + if (this._toDispose.has(o)) { + this._toDispose.delete(o); + setParentOfDisposable(o, null); + } } }