mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
fix listener leaks (#17913)
* fix listener leaks * add null check * simplify * pr comments
This commit is contained in:
@@ -276,6 +276,7 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
|
||||
if (profile) {
|
||||
newProfile = profile;
|
||||
}
|
||||
groups.forEach(group => group.dispose());
|
||||
}
|
||||
|
||||
const currentSelections = this._tree!.getSelection();
|
||||
|
||||
@@ -480,6 +480,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input as IConnectionProfile));
|
||||
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
||||
this._connectionDialog.render();
|
||||
this._connectionDialog.onClosed(() => {
|
||||
this._model?.dispose();
|
||||
});
|
||||
}
|
||||
this._connectionDialog.newConnectionParams = params;
|
||||
this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]);
|
||||
|
||||
@@ -8,7 +8,14 @@ import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { FuzzyScore } from 'vs/base/common/filters';
|
||||
import { TreeNode } from 'sql/workbench/services/objectExplorer/common/treeNode';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IAsyncDataTreeViewState } from 'vs/base/browser/ui/tree/asyncDataTree';
|
||||
|
||||
export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGroup, ServerTreeElement, FuzzyScore> { }
|
||||
export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGroup, ServerTreeElement, FuzzyScore> {
|
||||
override async setInput(input: ConnectionProfileGroup, viewState?: IAsyncDataTreeViewState): Promise<void> {
|
||||
const originalInput = this.getInput();
|
||||
await super.setInput(input, viewState);
|
||||
originalInput?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export type ServerTreeElement = ConnectionProfile | ConnectionProfileGroup | TreeNode;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/br
|
||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
||||
|
||||
import { TreeNode } from 'sql/workbench/services/objectExplorer/common/treeNode';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, isDisposable } from 'vs/base/common/lifecycle';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||
|
||||
@@ -125,8 +125,12 @@ export class TreeUpdateUtils {
|
||||
|
||||
let treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService);
|
||||
if (treeInput) {
|
||||
if (treeInput !== tree.getInput()) {
|
||||
const originalInput = tree.getInput();
|
||||
if (treeInput !== originalInput) {
|
||||
return tree.setInput(treeInput).then(async () => {
|
||||
if (isDisposable(originalInput)) {
|
||||
originalInput.dispose();
|
||||
}
|
||||
// Make sure to expand all folders that where expanded in the previous session
|
||||
if (targetsToExpand) {
|
||||
await tree.expandAll(targetsToExpand);
|
||||
|
||||
Reference in New Issue
Block a user