提交 8f496f22 编写于 作者: M Matt Bierner

Make sure we dispose of emitters for TerminalProcessExtHostProxy

上级 a6b38fc7
...@@ -5,36 +5,35 @@ ...@@ -5,36 +5,35 @@
import { Event, Emitter } from 'vs/base/common/event'; import { Event, Emitter } from 'vs/base/common/event';
import { ITerminalService, ITerminalProcessExtHostProxy, IShellLaunchConfig, ITerminalChildProcess, ITerminalConfigHelper } from 'vs/workbench/contrib/terminal/common/terminal'; import { ITerminalService, ITerminalProcessExtHostProxy, IShellLaunchConfig, ITerminalChildProcess, ITerminalConfigHelper } from 'vs/workbench/contrib/terminal/common/terminal';
import { IDisposable } from 'vs/base/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
let hasReceivedResponse: boolean = false; let hasReceivedResponse: boolean = false;
export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerminalProcessExtHostProxy { export class TerminalProcessExtHostProxy extends Disposable implements ITerminalChildProcess, ITerminalProcessExtHostProxy {
private _disposables: IDisposable[] = [];
private readonly _onProcessData = new Emitter<string>(); private readonly _onProcessData = this._register(new Emitter<string>());
public readonly onProcessData: Event<string> = this._onProcessData.event; public readonly onProcessData: Event<string> = this._onProcessData.event;
private readonly _onProcessExit = new Emitter<number>(); private readonly _onProcessExit = this._register(new Emitter<number>());
public readonly onProcessExit: Event<number> = this._onProcessExit.event; public readonly onProcessExit: Event<number> = this._onProcessExit.event;
private readonly _onProcessIdReady = new Emitter<number>(); private readonly _onProcessIdReady = this._register(new Emitter<number>());
public readonly onProcessIdReady: Event<number> = this._onProcessIdReady.event; public readonly onProcessIdReady: Event<number> = this._onProcessIdReady.event;
private readonly _onProcessTitleChanged = new Emitter<string>(); private readonly _onProcessTitleChanged = this._register(new Emitter<string>());
public readonly onProcessTitleChanged: Event<string> = this._onProcessTitleChanged.event; public readonly onProcessTitleChanged: Event<string> = this._onProcessTitleChanged.event;
private readonly _onInput = new Emitter<string>(); private readonly _onInput = this._register(new Emitter<string>());
public readonly onInput: Event<string> = this._onInput.event; public readonly onInput: Event<string> = this._onInput.event;
private readonly _onResize: Emitter<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>(); private readonly _onResize: Emitter<{ cols: number, rows: number }> = this._register(new Emitter<{ cols: number, rows: number }>());
public readonly onResize: Event<{ cols: number, rows: number }> = this._onResize.event; public readonly onResize: Event<{ cols: number, rows: number }> = this._onResize.event;
private readonly _onShutdown = new Emitter<boolean>(); private readonly _onShutdown = this._register(new Emitter<boolean>());
public readonly onShutdown: Event<boolean> = this._onShutdown.event; public readonly onShutdown: Event<boolean> = this._onShutdown.event;
private readonly _onRequestInitialCwd = new Emitter<void>(); private readonly _onRequestInitialCwd = this._register(new Emitter<void>());
public readonly onRequestInitialCwd: Event<void> = this._onRequestInitialCwd.event; public readonly onRequestInitialCwd: Event<void> = this._onRequestInitialCwd.event;
private readonly _onRequestCwd = new Emitter<void>(); private readonly _onRequestCwd = this._register(new Emitter<void>());
public readonly onRequestCwd: Event<void> = this._onRequestCwd.event; public readonly onRequestCwd: Event<void> = this._onRequestCwd.event;
private readonly _onRequestLatency = new Emitter<void>(); private readonly _onRequestLatency = this._register(new Emitter<void>());
public readonly onRequestLatency: Event<void> = this._onRequestLatency.event; public readonly onRequestLatency: Event<void> = this._onRequestLatency.event;
private _pendingInitialCwdRequests: ((value?: string | Thenable<string>) => void)[] = []; private _pendingInitialCwdRequests: ((value?: string | Thenable<string>) => void)[] = [];
...@@ -51,6 +50,7 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm ...@@ -51,6 +50,7 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm
@ITerminalService private readonly _terminalService: ITerminalService, @ITerminalService private readonly _terminalService: ITerminalService,
@IRemoteAgentService readonly remoteAgentService: IRemoteAgentService @IRemoteAgentService readonly remoteAgentService: IRemoteAgentService
) { ) {
super();
remoteAgentService.getEnvironment().then(env => { remoteAgentService.getEnvironment().then(env => {
if (!env) { if (!env) {
throw new Error('Could not fetch environment'); throw new Error('Could not fetch environment');
...@@ -62,11 +62,6 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm ...@@ -62,11 +62,6 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm
} }
} }
public dispose(): void {
this._disposables.forEach(d => d.dispose());
this._disposables.length = 0;
}
public emitData(data: string): void { public emitData(data: string): void {
this._onProcessData.fire(data); this._onProcessData.fire(data);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册