[PR #19023] Fix crash when closing multiple panes simultaneously #31677

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

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

State: closed
Merged: Yes


Summary of the Pull Request

Fixes a crash when multiple panes were closed simultaneously (i.e. using broadcast input).

The root cause of this crash was that we would get a null pointer exception when trying to access a member/function off of a null _content. This is because Pane::_CloseChild() would always pass over the content from the non-closed pane and attempt to hook everything up to it.

The fix was to operate similarly to Pane::Close() and raise a Closed event and return early. Since there's no alternative content to attach to, might as well just close the entire pane. This propagates up the stack of listeners to update the UI appropriately and close the parent pane and eventually the entire tab, if necessary.
 
Closes #18071
Closes #17432

Validation Steps Performed

  1. Open 2 panes
  2. Use broadcast input to send "exit" to both panes
  3. Terminal doesn't crash and the tab closes gracefully
**Original Pull Request:** https://github.com/microsoft/terminal/pull/19023 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Fixes a crash when multiple panes were closed simultaneously (i.e. using broadcast input). The root cause of this crash was that we would get a null pointer exception when trying to access a member/function off of a null `_content`. This is because `Pane::_CloseChild()` would always pass over the content from the non-closed pane and attempt to hook everything up to it. The fix was to operate similarly to `Pane::Close()` and raise a `Closed` event and return early. Since there's no alternative content to attach to, might as well just close the entire pane. This propagates up the stack of listeners to update the UI appropriately and close the parent pane and eventually the entire tab, if necessary.   Closes #18071 Closes #17432 ## Validation Steps Performed 1. Open 2 panes 2. Use broadcast input to send "exit" to both panes 3. ✅ Terminal doesn't crash and the tab closes gracefully
claunia added the pull-request label 2026-01-31 09:48:48 +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#31677