Use DisposableMap for session listener lifecycle in FocusSessionActionViewItem#293442
Draft
Use DisposableMap for session listener lifecycle in FocusSessionActionViewItem#293442
Conversation
Fixes memory leaks caused by using this._register() inside callbacks that fire multiple times. Each call added entries to the disposable store that were never cleaned up. Fixes: - problemCollectors: register inside onModelRemoved handler - loadedScriptsView: session listeners without per-session cleanup - debugActionViewItems: existing sessions not tracked for cleanup - terminalTaskSystem: register inside terminate() method - textAreaEditContextInput: register inside runAndSubscribe callback - terminal.history.contribution: register inside onDidAddCapability - terminalInstance: nested register in capability handler - storageMainService: per-profile listeners accumulating
…sables # Conflicts: # src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Address feedback to use disposable map in leak fix implementation
Use DisposableMap for session listener lifecycle in FocusSessionActionViewItem
Feb 6, 2026
Member
|
@copilot merge main and fix conflicts |
Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses review feedback from #293155 to use
DisposableMapfor tracking debug session listeners, preventing leaks when the component is disposed while sessions are still active.Changes
Replaced array-based listener tracking with DisposableMap pattern:
DisposableMap<string, DisposableStore>registered with component lifecycleloadedScriptsView.ts:545-591Simplified disposal logic:
onDidEndAdaptercleanup (sessions always fireonDidEndSession)registerSessionListenersto handle potential duplicate callsMerged main branch:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.