From bc6f3e22757415e42e658597c60b40c003941289 Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Thu, 12 Sep 2024 17:03:39 +0200 Subject: [PATCH] Fix a crash on pane close (#17886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ✅ --- src/cascadia/TerminalApp/Pane.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index a210b70152..dc235b0602 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -2956,13 +2956,13 @@ bool Pane::ContainsReadOnly() const // - void Pane::CollectTaskbarStates(std::vector& states) { - if (_IsLeaf()) + if (_content) { auto tbState{ winrt::make(_content.TaskbarState(), _content.TaskbarProgress()) }; states.push_back(tbState); } - else + else if (_firstChild && _secondChild) { _firstChild->CollectTaskbarStates(states); _secondChild->CollectTaskbarStates(states);