Skip to content

fix(terminal): guard against disposed link detector adapter#318321

Open
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/316439-terminal-link-disposed
Open

fix(terminal): guard against disposed link detector adapter#318321
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/316439-terminal-link-disposed

Conversation

@SpencerJung
Copy link
Copy Markdown

Related Issue

Closes #316439

Summary

TerminalLinkDetectorAdapter._createTerminalLink was calling createInstance on a disposed InstantiationService when the terminal had been closed while link detection was in progress, causing unhandled "InstantiationService has been disposed" errors.

Changes

  • Add disposed check (this._store.isDisposed) before the createInstance call in _createTerminalLink
  • Throw a descriptive error instead of letting the unhandled InstantiationService error propagate

Verification Evidence

  • npm run compile-check-ts-native: PASSED (no TypeScript errors)

Checklist

  • Base branch is main
  • No unauthorized version bump
  • All feasible verification checks attempted
  • No unintended schema or lockfile changes

…t#316439)

TerminalLinkDetectorAdapter._createTerminalLink was calling
createInstance on a disposed InstantiationService when the terminal
had been closed while link detection was in progress.

- Add disposed check before createInstance call
- Throw descriptive error instead of unhandled InstantiationService disposed error

Fixes microsoft#316439
Copilot AI review requested due to automatic review settings May 26, 2026 09:30
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkDetectorAdapter.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a disposal-state guard to prevent creating terminal links after TerminalLinkDetectorAdapter has been disposed.

Changes:

  • Introduces an isDisposed check on the adapter’s disposable store before creating a TerminalLink.
  • Throws an error when link creation is attempted after disposal.

Comment on lines +106 to +108
if (this._store.isDisposed) {
throw new Error('Terminal link detector adapter has been disposed');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Error] unhandlederror-InstantiationService has been disposed

3 participants