diff --git a/src/sql/workbench/parts/query/browser/queryEditor.ts b/src/sql/workbench/parts/query/browser/queryEditor.ts index 15e777810c..0322402dfa 100644 --- a/src/sql/workbench/parts/query/browser/queryEditor.ts +++ b/src/sql/workbench/parts/query/browser/queryEditor.ts @@ -251,6 +251,7 @@ export class QueryEditor extends BaseEditor { if (oldInput) { this.currentTextEditor.clearInput(); + this.resultsEditor.clearInput(); } // If we're switching editor types switch out the views diff --git a/src/sql/workbench/parts/query/browser/queryResultsView.ts b/src/sql/workbench/parts/query/browser/queryResultsView.ts index ff4195143b..6f2da98ebe 100644 --- a/src/sql/workbench/parts/query/browser/queryResultsView.ts +++ b/src/sql/workbench/parts/query/browser/queryResultsView.ts @@ -296,18 +296,21 @@ export class QueryResultsView extends Disposable { if (info) { this.setQueryRunner(info.queryRunner); } else { - let disposeable = this.queryModelService.onRunQueryStart(c => { + let disposable = this.queryModelService.onRunQueryStart(c => { if (c === input.uri) { let info = this.queryModelService._getQueryInfo(input.uri); this.setQueryRunner(info.queryRunner); - disposeable.dispose(); + disposable.dispose(); } }); + this.runnerDisposables.push(disposable); } } clearInput() { this._input = undefined; + dispose(this.runnerDisposables); + this.runnerDisposables = []; this.resultsTab.clear(); this.messagesTab.clear(); this.qpTab.clear(); @@ -389,6 +392,7 @@ export class QueryResultsView extends Disposable { public dispose() { dispose(this.runnerDisposables); + this.runnerDisposables = []; super.dispose(); }