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
This commit is contained in:
Matt Bierner 2019-06-06 01:31:01 -07:00
parent d44c5f4731
commit b86bdf8a0b

View file

@ -1699,21 +1699,9 @@ export class SearchView extends ViewletPanel {
super.saveState();
}
private _toDispose: IDisposable[] = [];
protected _register<T extends IDisposable>(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();
}
}