dispose and clear things out when they are not needed to free up memory (#5805)

This commit is contained in:
Anthony Dresser
2019-05-31 17:24:01 -07:00
committed by Karl Burtram
parent ba58b0f429
commit 23e4a30cd1
4 changed files with 19 additions and 34 deletions

View File

@@ -77,7 +77,7 @@ export class MessagePanel extends Disposable {
private styleElement = createStyleSheet(this.container);
private queryRunnerDisposables: IDisposable[] = [];
private _state: MessagePanelState;
private _state: MessagePanelState | undefined;
private tree: ITree;
@@ -201,7 +201,7 @@ export class MessagePanel extends Disposable {
}
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this.tree;
if (this.state.scrollPosition) {
if (this.state && this.state.scrollPosition) {
const previousScroll = this.state.scrollPosition;
this.tree.refresh(this.model).then(() => {
// Restore the previous scroll position when switching between tabs
@@ -233,6 +233,7 @@ export class MessagePanel extends Disposable {
private reset() {
this.model.messages = [];
this._state = undefined;
this.model.totalExecuteMessage = undefined;
this.tree.refresh(this.model);
}