From b86bdf8a0be2cc9ee243ca72a803f61c43291ce0 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 6 Jun 2019 01:31:01 -0700 Subject: [PATCH] Fix TS order of initilization issue around dispose and _register By overriding _register in this case, we could end up invoking this function on a subclass that had not actually been inited yet (when `_toDispose` has not been set). I believe the overriding was an accident, so the fix is to remove it --- .../workbench/contrib/search/browser/searchView.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index b9d91e16a7e..b065ac3e7c5 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1699,21 +1699,9 @@ export class SearchView extends ViewletPanel { super.saveState(); } - private _toDispose: IDisposable[] = []; - protected _register(t: T): T { - if (this.isDisposed) { - console.warn('Registering disposable on object that has already been disposed.'); - t.dispose(); - } else { - this._toDispose.push(t); - } - return t; - } - dispose(): void { this.isDisposed = true; this.saveState(); - this._toDispose = dispose(this._toDispose); super.dispose(); } }