[PR #892] [CLOSED] Fix crash when closing last tab #24373

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/892
Author: @fghzxm
Created: 5/18/2019
Status: Closed

Base: masterHead: push/fix-close-last-tab


📝 Commits (8)

  • e0b3190 Fix crash when closing last tab
  • a0b9e89 Convert tabs to spaces
  • 059c7c5 Assert function call that should not fail
  • f665a9b Restore variable initialization to avoid warnings
  • 302b37d Restore removing last Tab when closing last tab
  • 953c737 Restore parentheses in ternary expression
  • f8efdb9 Fix regression of issue #708
  • 0e9fddb Revert "Fix regression of issue #708"

📊 Changes

1 file changed (+20 additions, -12 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+20 -12)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/892 **Author:** [@fghzxm](https://github.com/fghzxm) **Created:** 5/18/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `push/fix-close-last-tab` --- ### 📝 Commits (8) - [`e0b3190`](https://github.com/microsoft/terminal/commit/e0b3190ac73256342e2f10190d385457106f616e) Fix crash when closing last tab - [`a0b9e89`](https://github.com/microsoft/terminal/commit/a0b9e894d822f2c44ce8a5d583d57ea4aaa8b813) Convert tabs to spaces - [`059c7c5`](https://github.com/microsoft/terminal/commit/059c7c56812a9a412c340ccc93bae512bba1c780) Assert function call that should not fail - [`f665a9b`](https://github.com/microsoft/terminal/commit/f665a9b1dcd585441dd7c3d9e970bd2493aa2216) Restore variable initialization to avoid warnings - [`302b37d`](https://github.com/microsoft/terminal/commit/302b37d615a3297ed2bf16a1e61c934f95cb2439) Restore removing last Tab when closing last tab - [`953c737`](https://github.com/microsoft/terminal/commit/953c7371fff99e3da317b04f3a91d2a88f94e2fa) Restore parentheses in ternary expression - [`f8efdb9`](https://github.com/microsoft/terminal/commit/f8efdb96f82570b947aad176c690b58ed919840d) Fix regression of issue #708 - [`0e9fddb`](https://github.com/microsoft/terminal/commit/0e9fddbf7f10c36c0027483605ea82e721c51d91) Revert "Fix regression of issue #708" ### 📊 Changes **1 file changed** (+20 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+20 -12) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:02:52 +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#24373