Crash when attempting to split pane with insufficient space available #3371

Closed
opened 2026-01-30 23:19:47 +00:00 by claunia · 4 comments
Owner

Originally created by @richardszalay on GitHub (Aug 12, 2019).

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.175]
Windows Terminal version (if applicable):0.3.2171.0

Steps to reproduce

  1. Map a key binding to splitHorizontal
  2. Invoke the splitHorizontal key binding beyond the point where space is available for the split (~6-7 times)

NOTE: It also happens when splitting vertically but it appears to allow more before crashing.

Expected behavior

Worth discussing, but I'm guessing it would simply reject the command and perform a system beep (or some other indication of the failure)

Actual behavior

Application crash

Originally created by @richardszalay on GitHub (Aug 12, 2019). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.175] Windows Terminal version (if applicable):0.3.2171.0 ``` # Steps to reproduce 1. Map a key binding to `splitHorizontal` 2. Invoke the `splitHorizontal` key binding beyond the point where space is available for the split (~6-7 times) NOTE: It also happens when splitting vertically but it appears to allow more before crashing. # Expected behavior Worth discussing, but I'm guessing it would simply reject the command and perform a system beep (or some other indication of the failure) # Actual behavior Application crash
Author
Owner

@richardszalay commented on GitHub (Aug 16, 2019):

I've confirmed that the root cause of the error is that splitting small panes results in a width/height of 0, which causes the DxRenderer to fail when creating the device resources.

I'd like to PR this if you don't mind. Here's my proposed implementation, but I'm happy to PR it as a spec if you think the issue warrants it:

App::_SplitPane will call focusedTab->CanAddHorizontalSplit/CanAddHorizontalSplit before it initializes the TermControl to avoid having to deal with the cleanup. If a split cannot occur, it will simply return. Question Should we beep or something here?

I'll follow the same naming conventions that already exist, so: Tab::CanAddHorizontalSplit -> Pane::CanSplitHorizontal ->Pane::_CanSplit. The public pane methods will handle leaf/child the same as the current Split methods.

_CanSplit will reuse existing logic to determine the split, including _root.GetActualWidth/height, Pane::_GetMinSize, and the Half constant.

@richardszalay commented on GitHub (Aug 16, 2019): I've confirmed that the root cause of the error is that splitting small panes results in a width/height of 0, which causes the DxRenderer to fail when creating the device resources. I'd like to PR this if you don't mind. Here's my proposed implementation, but I'm happy to PR it as a spec if you think the issue warrants it: `App::_SplitPane` will call `focusedTab->CanAddHorizontalSplit/CanAddHorizontalSplit` _before_ it initializes the `TermControl` to avoid having to deal with the cleanup. If a split cannot occur, it will simply return. **Question** Should we beep or something here? I'll follow the same naming conventions that already exist, so: `Tab::CanAddHorizontalSplit -> Pane::CanSplitHorizontal ->Pane::_CanSplit`. The public pane methods will handle leaf/child the same as the current Split methods. `_CanSplit` will reuse existing logic to determine the split, including `_root.GetActualWidth/height`, `Pane::_GetMinSize`, and the `Half` constant.
Author
Owner

@richardszalay commented on GitHub (Aug 16, 2019):

If you're happy with my proposed design and don't think it needs a beep, I've submitted a PR.

@richardszalay commented on GitHub (Aug 16, 2019): If you're happy with my proposed design and don't think it needs a beep, I've submitted a PR.
Author
Owner

@zadjii-msft commented on GitHub (Aug 16, 2019):

Yea I definitely don't think we need a beep currently. We don't beep for anything else quite yet, so we could always add a (optional) beep here later when we add beeps to the rest of the app.

Good work with the PR!

@zadjii-msft commented on GitHub (Aug 16, 2019): Yea I definitely don't think we need a beep currently. We don't beep for _anything_ else quite yet, so we could always add a (optional) beep here later when we add beeps to the rest of the app. Good work with the PR!
Author
Owner

@ghost commented on GitHub (Aug 27, 2019):

:tada:This issue was addressed in #2450, which has now been successfully released as Windows Terminal Preview v0.4.2382.0.🎉

Handy links:

@ghost commented on GitHub (Aug 27, 2019): :tada:This issue was addressed in #2450, which has now been successfully released as `Windows Terminal Preview v0.4.2382.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.4.2382.0) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3371