mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
fix: memory leak in terminal editor (#279088)
This commit is contained in:
@@ -47,6 +47,8 @@ export class TerminalEditor extends EditorPane {
|
|||||||
|
|
||||||
private readonly _newDropdown: MutableDisposable<DropdownWithPrimaryActionViewItem> = this._register(new MutableDisposable());
|
private readonly _newDropdown: MutableDisposable<DropdownWithPrimaryActionViewItem> = this._register(new MutableDisposable());
|
||||||
|
|
||||||
|
private readonly _sessionDisposables = this._register(new DisposableStore());
|
||||||
|
|
||||||
private readonly _disposableStore = this._register(new DisposableStore());
|
private readonly _disposableStore = this._register(new DisposableStore());
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -84,13 +86,14 @@ export class TerminalEditor extends EditorPane {
|
|||||||
// since the editor does not monitor focus changes, for ex. between the terminal
|
// since the editor does not monitor focus changes, for ex. between the terminal
|
||||||
// panel and the editors, this is needed so that the active instance gets set
|
// panel and the editors, this is needed so that the active instance gets set
|
||||||
// when focus changes between them.
|
// when focus changes between them.
|
||||||
this._register(this._editorInput.terminalInstance.onDidFocus(() => this._setActiveInstance()));
|
this._sessionDisposables.add(this._editorInput.terminalInstance.onDidFocus(() => this._setActiveInstance()));
|
||||||
this._editorInput.setCopyLaunchConfig(this._editorInput.terminalInstance.shellLaunchConfig);
|
this._editorInput.setCopyLaunchConfig(this._editorInput.terminalInstance.shellLaunchConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override clearInput(): void {
|
override clearInput(): void {
|
||||||
super.clearInput();
|
super.clearInput();
|
||||||
|
this._sessionDisposables.clear();
|
||||||
if (this._overflowGuardElement && this._editorInput?.terminalInstance?.domElement.parentElement === this._overflowGuardElement) {
|
if (this._overflowGuardElement && this._editorInput?.terminalInstance?.domElement.parentElement === this._overflowGuardElement) {
|
||||||
this._editorInput.terminalInstance?.detachFromElement();
|
this._editorInput.terminalInstance?.detachFromElement();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user