Fix some connection listener leaks (#6357)

* Fix some connection listener leaks

* More descriptive name and update summary

* Dispose some more connections and fix a few spelling errors
This commit is contained in:
Charles Gagnon
2019-07-29 11:00:11 -07:00
committed by GitHub
parent 1d56a17f32
commit 86cde4c511
9 changed files with 66 additions and 28 deletions

View File

@@ -13,6 +13,7 @@ import { NodeType } from 'sql/workbench/parts/objectExplorer/common/nodeType';
import { TreeNode } from 'sql/workbench/parts/objectExplorer/common/treeNode';
import * as errors from 'vs/base/common/errors';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { Disposable } from 'vs/base/common/lifecycle';
export interface IExpandableTree extends ITree {
// {{SQL CARBON EDIT }} - add back deleted VS Code tree methods
@@ -72,8 +73,11 @@ export class TreeUpdateUtils {
} else if (viewKey === 'saved') {
treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers);
}
const previousTreeInput: any = tree.getInput();
return tree.setInput(treeInput).then(() => {
if (previousTreeInput instanceof Disposable) {
previousTreeInput.dispose();
}
// Make sure to expand all folders that where expanded in the previous session
if (targetsToExpand) {
tree.expandAll(targetsToExpand);
@@ -135,6 +139,7 @@ export class TreeUpdateUtils {
if (groups && groups.length > 0) {
let treeInput = groups[0];
treeInput.name = 'root';
groups.forEach(cpg => cpg.dispose());
return treeInput;
}
// Should never get to this case.