Skip to content

Conversation

@vijayupadya
Copy link
Contributor

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.

@vijayupadya vijayupadya requested review from Copilot and mjbvz October 31, 2025 01:30
@vs-code-engineering
Copy link

vs-code-engineering bot commented Oct 31, 2025

📬 CODENOTIFY

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

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatSessions/view/sessionsViewPane.ts

Copy link
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

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 DisposableStore to 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

'codicon-chevron-down',
true
);
this._dropdownDisposables.add(dropdownAction);
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@vijayupadya vijayupadya merged commit b500864 into microsoft:main Nov 3, 2025
17 checks passed
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.

SessionViewPane leaks dropdown, menu items

2 participants