Skip to content

Commit

Permalink
Fix a crash on pane close (#17886)
Browse files Browse the repository at this point in the history
The underlying issue is that the "Pane" is used both as a model and as
a UI element and so a pane loses its content as soon as it is closed,
but the tree only gets reordered after the animation has finished.
This PR is truly just a hotfix, because it doesn't solve this issue,
it only adds checks to the function that crashes.

Closes #17869
Closes #17871

## Validation Steps Performed
* `Split pane` a few times
* Run the "Close all other panes" action
* Doesn't crash ✅

(cherry picked from commit bc6f3e2)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgTEJYE
Service-Version: 1.21
  • Loading branch information
lhecker authored and DHowett committed Sep 16, 2024
1 parent b6326cf commit bdb67a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cascadia/TerminalApp/Pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2955,13 +2955,13 @@ bool Pane::ContainsReadOnly() const
// - <none>
void Pane::CollectTaskbarStates(std::vector<winrt::TerminalApp::TaskbarState>& states)
{
if (_IsLeaf())
if (_content)
{
auto tbState{ winrt::make<winrt::TerminalApp::implementation::TaskbarState>(_content.TaskbarState(),
_content.TaskbarProgress()) };
states.push_back(tbState);
}
else
else if (_firstChild && _secondChild)
{
_firstChild->CollectTaskbarStates(states);
_secondChild->CollectTaskbarStates(states);
Expand Down

0 comments on commit bdb67a3

Please sign in to comment.