未验证 提交 b0231fd6 编写于 作者: A Alex Ross 提交者: GitHub

Fix bad dispose in automatic port forwarding (#108195)

Fixes #107243
上级 2ccf7951
......@@ -841,7 +841,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
}
class AutomaticPortForwarding extends Disposable implements IWorkbenchContribution {
private contextServiceListener: IDisposable;
private contextServiceListener?: IDisposable;
constructor(
@ITerminalService private readonly terminalService: ITerminalService,
......@@ -855,12 +855,13 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
super();
if (this.environmentService.configuration.remoteAuthority) {
this.startUrlFinder();
} else {
this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => {
if (e.affectsSome(new Set(forwardedPortsViewEnabled.keys()))) {
this.startUrlFinder();
}
}));
}
this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => {
if (e.affectsSome(new Set(forwardedPortsViewEnabled.keys()))) {
this.startUrlFinder();
}
}));
}
private isStarted = false;
......@@ -868,7 +869,9 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
if (!this.isStarted && !forwardedPortsViewEnabled.getValue(this.contextKeyService)) {
return;
}
this.contextServiceListener.dispose();
if (this.contextServiceListener) {
this.contextServiceListener.dispose();
}
this.isStarted = true;
const urlFinder = this._register(new UrlFinder(this.terminalService));
this._register(urlFinder.onDidMatchLocalUrl(async (localUrl) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册