[PR #8653] Prevent Tab Switcher from increasing Tab refcount #27268

Closed
opened 2026-01-31 09:20:57 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/8653

State: closed
Merged: Yes


Fix TabPaletteItem to hold only a weak reference to a tab.
This way we guarantee that the refcount of the closed tab
gets to 0 immediately
(and that command palette cannot "raise it from the dead").

While this seems a correct thing to do,
it is still not clear why the FilteredCommand itself
(the one holding the TabPaletteItem) doesn't get released
until the UI is refreshed.

There is an impact of not registering to PropertyChanged event:
if the tab title changes during Tab Switcher navigation
the Tab Switcher item won't be updated immediately
(the change will apply next time the Tab Switcher is open).

Due to this change we need to make sure that the tabs binding
in https://github.com/microsoft/terminal/pull/8427
doesn't break the title / icon update.

Validation Steps Performed

  • Manual testing

Closes #8651

**Original Pull Request:** https://github.com/microsoft/terminal/pull/8653 **State:** closed **Merged:** Yes --- Fix `TabPaletteItem` to hold only a weak reference to a tab. This way we guarantee that the refcount of the closed tab gets to 0 immediately (and that command palette cannot "raise it from the dead"). While this seems a correct thing to do, it is still not clear why the `FilteredCommand` itself (the one holding the `TabPaletteItem`) doesn't get released until the UI is refreshed. There is an impact of not registering to PropertyChanged event: if the tab title changes during Tab Switcher navigation the Tab Switcher item won't be updated immediately (the change will apply next time the Tab Switcher is open). Due to this change we need to make sure that the tabs binding in https://github.com/microsoft/terminal/pull/8427 doesn't break the title / icon update. ## Validation Steps Performed * Manual testing Closes #8651
claunia added the pull-request label 2026-01-31 09:20:57 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27268