[PR #892] Fix crash when closing last tab #24378

Open
opened 2026-01-31 09:02:54 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: No


Summary of the Pull Request

This commit fixes crashes that happen when the last tab is being closed.

References

None.

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Commit bc69d1a99a adds code that closes
the window when the last tab is being closed, but code that should only
be executed when closing one of multiple open tabs continues to be
executed. This leads to App::_RemoveTabViewItem trying to call
TabView::SelectedIndex(1) when there is only 1 tab remaining in the
TabView, resulting in an argument exception.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/892 **State:** closed **Merged:** No --- ## Summary of the Pull Request This commit fixes crashes that happen when the last tab is being closed. ## References None. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #xxx * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments Commit bc69d1a99a8921b5088c035096e659b9e0a1d50e adds code that closes the window when the last tab is being closed, but code that should only be executed when closing one of multiple open tabs continues to be executed. This leads to App::_RemoveTabViewItem trying to call TabView::SelectedIndex(1) when there is only 1 tab remaining in the TabView, resulting in an argument exception.
claunia added the pull-request label 2026-01-31 09:02:54 +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#24378