-
Notifications
You must be signed in to change notification settings - Fork 35.9k
Fix SessionViewPane leaks #274239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SessionViewPane leaks #274239
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a memory leak in the chat sessions view by properly disposing of resources created when action view items are recreated. When the toolbar recreates action items, the previous menu and dropdownAction instances were not being disposed, leading to potential memory leaks.
Key Changes
- Adds a
DisposableStoreto track disposables for the chat session dropdown - Clears previous disposables before creating new action view items
- Registers the menu and dropdown action with the disposable store
src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.ts
Show resolved
Hide resolved
| 'codicon-chevron-down', | ||
| true | ||
| ); | ||
| this._dropdownDisposables.add(dropdownAction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can dropdownAction be converted to use toAction instead? That version of IAction isn't disposable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Fixes #274236
The getChatSessionDropdown method created disposable objects (dropdownAction Action and menu IMenu) that were never registered with a parent or explicitly disposed. These orphaned disposables were passed to DropdownWithPrimaryActionViewItem but the view item doesn't take ownership, causing them to leak.