Skip to content

Fix listener leak in FocusSessionActionViewItem#311759

Merged
roblourens merged 5 commits intomainfrom
roblou/agents/vscode-issue-308534-fix-2
Apr 21, 2026
Merged

Fix listener leak in FocusSessionActionViewItem#311759
roblourens merged 5 commits intomainfrom
roblou/agents/vscode-issue-308534-fix-2

Conversation

@roblourens
Copy link
Copy Markdown
Member

Fixes #308534 (Written by Copilot)

Listeners added to debug sessions (onDidChangeName / onDidEndAdapter) in FocusSessionActionViewItem's constructor were not tied to the view item's lifetime. Since debug sessions outlive the action view item (it gets recreated on toolbar / title-area updates), each recreation piled more listeners onto the same long-lived sessions, eventually tripping the "potential listener LEAK detected, popular" warning from the REPL title toolbar.

Fix: route all per-session listeners through a DisposableStore owned by the view item, so they're released when the view item is disposed — while still self-cleaning when the session ends (and removing themselves from the parent store so disposed children don't accumulate).

(Recreated from #311745 / #311758, which had stuck CI jobs.)

roblourens and others added 3 commits April 21, 2026 10:23
Listeners added to debug sessions (onDidChangeName/onDidEndAdapter) in
the constructor were not tied to the view item's lifetime. Since debug
sessions outlive the action view item (recreated on toolbar updates),
each recreation piled more listeners onto the same sessions, eventually
triggering the 'potential listener LEAK detected' warning.

Route all per-session listeners through a DisposableStore owned by the
view item so they are released when the view item is disposed, while
still self-cleaning when the session ends.

Fixes #308534

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use sessionListenersStore.delete() instead of sessionListeners.dispose()
so that ended sessions don't accumulate disposed stores in the parent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 21, 2026 18:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Screenshot Changes

Base: 51d818fe Current: 9aea1fcd

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

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

Fixes a listener leak in FocusSessionActionViewItem by ensuring per-debug-session event listeners are properly scoped to the action view item’s lifetime, preventing repeated toolbar/title-area recreations from piling listeners onto long-lived debug sessions.

Changes:

  • Introduces a DisposableStore owned by FocusSessionActionViewItem to track per-session listeners.
  • Ensures per-session listener stores are disposed both when the view item is disposed and when a session’s adapter ends.
Show a summary per file
File Description
src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts Routes onDidChangeName / onDidEndAdapter listeners through a view-item-owned DisposableStore to prevent listener accumulation across view item recreations.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts
@roblourens roblourens enabled auto-merge (squash) April 21, 2026 19:11
@roblourens roblourens closed this Apr 21, 2026
auto-merge was automatically disabled April 21, 2026 21:59

Pull request was closed

@roblourens roblourens reopened this Apr 21, 2026
@roblourens roblourens enabled auto-merge (squash) April 21, 2026 21:59
@roblourens roblourens merged commit 895cf90 into main Apr 21, 2026
26 checks passed
@roblourens roblourens deleted the roblou/agents/vscode-issue-308534-fix-2 branch April 21, 2026 23:57
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Unhandled Error] potential listener LEAK detected, popular — debug/repl / debugActionViewItems

3 participants