Skip to content

Commit e73ff76

Browse files
committed
Always remove terminals from associations when they dispose
Fixes microsoft#257063
1 parent b75f5d8 commit e73ff76

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
153153

154154
// Restore terminal associations from storage
155155
this._restoreTerminalAssociations();
156+
this._register(this._terminalService.onDidDisposeInstance(e => {
157+
for (const [sessionId, toolTerminal] of this._sessionTerminalAssociations.entries()) {
158+
if (e === toolTerminal.instance) {
159+
this._sessionTerminalAssociations.delete(sessionId);
160+
}
161+
}
162+
}));
156163
}
157164

158165
async prepareToolInvocation(context: IToolInvocationPreparationContext, token: CancellationToken): Promise<IPreparedToolInvocation | undefined> {

0 commit comments

Comments
 (0)