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

@@ -316,8 +316,11 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
}
this._model.providerName = this._currentProviderType;
const previousModel = this._model;
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
if (previousModel) {
previousModel.dispose();
}
if (this._inputModel && this._inputModel.options) {
this.uiController.showUiComponent(input.container,
this._inputModel.options.authTypeChanged);
@@ -333,9 +336,12 @@ export class ConnectionDialogService implements IConnectionDialogService {
private handleFillInConnectionInputs(connectionInfo: IConnectionProfile): void {
this._connectionManagementService.addSavedPassword(connectionInfo).then(connectionWithPassword => {
let model = this.createModel(connectionWithPassword);
this._model = model;
this.uiController.fillInConnectionInputs(model);
if (this._model) {
this._model.dispose();
}
this._model = this.createModel(connectionWithPassword);
this.uiController.fillInConnectionInputs(this._model);
});
this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[connectionInfo.providerName]);
}
@@ -349,6 +355,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private updateModelServerCapabilities(model: IConnectionProfile) {
if (this._model) {
this._model.dispose();
}
this._model = this.createModel(model);
if (this._model.providerName) {
this._currentProviderType = this._model.providerName;
@@ -452,8 +461,10 @@ export class ConnectionDialogService implements IConnectionDialogService {
this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]);
return new Promise<void>(() => {
this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0);
const recentConnections: ConnectionProfile[] = this._connectionManagementService.getRecentConnections(params.providers);
this._connectionDialog.open(recentConnections.length > 0);
this.uiController.focusOnOpen();
recentConnections.forEach(conn => conn.dispose());
});
}