microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.25k stars 8.27k forks source link

Crash when choosing 'Close all other panes' #17871

Closed Treit closed 4 weeks ago

Treit commented 1 month ago

Windows Terminal version

1.22.2362.0

Windows build number

10.0.27699.0

Other Software

No response

Steps to reproduce

  1. Open Windows Terminal.
  2. Split panes so there are at least two panes.
  3. Ctrl+Shift+P and choose ‘Close all other panes’

Expected Behavior

No crash.

Actual Behavior

Terminal crashes with an access violation:

(3c78.4aa0): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
TerminalApp!winrt::impl::consume_TerminalApp_IPaneContent<winrt::TerminalApp::IPaneContent>::TaskbarProgress+0x34 [inlined in TerminalApp!Pane::CollectTaskbarStates+0x82]:
00007ffb`45483032 488b01          mov     rax,qword ptr [rcx] ds:00000000`00000000=????????????????

Here is the call stack:

TerminalApp!winrt::impl::consume_TerminalApp_IPaneContent<winrt::TerminalApp::IPaneContent>::TaskbarProgress
TerminalApp!Pane::CollectTaskbarStates
TerminalApp!Pane::CollectTaskbarStates
TerminalApp!winrt::TerminalApp::implementation::TerminalTab::GetCombinedTaskbarState
TerminalApp!winrt::TerminalApp::implementation::TerminalPage::TaskbarState
TerminalApp!winrt::TerminalApp::implementation::TerminalWindow::TaskbarState
TerminalApp!winrt::impl::produce<winrt::TerminalApp::implementation::TerminalWindow,winrt::TerminalApp::ITerminalWindow>::get_TaskbarState
WindowsTerminal
WindowsTerminal
TerminalApp!winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Foundation::IInspectable,winrt::Windows::Foundation::IInspectable>::operator()
TerminalApp!wil::details::dispatcher_handler::operator()
TerminalApp!winrt::impl::delegate<winrt::Windows::UI::Core::DispatchedHandler,wil::details::dispatcher_handler>::Invoke
Windows_UI!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::System::IDispatcherQueueHandler::*)(void)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::System::IDispatcherQueueHandler,Microsoft::WRL::FtmBase>,<lambda_980f345bc6e4ac8a906323c24a5fe9b1>,-1>::Invoke
CoreMessaging!Windows::System::DispatcherQueue::DeferInvokeCallback
CoreMessaging!CFlat::SehSafe::Execute<<lambda_654db17c35df07198786f0867aa10de6> >
CoreMessaging!Microsoft::CoreUI::ActionCallback::ImportAdapter$
CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch
CoreMessaging!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch
CoreMessaging!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchLoop
CoreMessaging!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop
user32!_fnDWORD
ntdll!KiUserCallbackDispatcherContinue
win32u!NtUserGetMessage
user32!GetMessageW
WindowsTerminal
WindowsTerminal
WindowsTerminal
ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>
KERNEL32!BaseThreadInitThunk
ntdll!RtlUserThreadStart
j4james commented 1 month ago

I suspect this is the same underlying bug as #17869. If I try and reproduce that one in the debugger I get a very similar stack trace to this crash.

lhecker commented 1 month ago

This must've regressed in #17750. Since we never wrote down what made it originally crash, I guessed it happened by simply closing panes, but this shows it was via the "Close all other panes" action. Not 100% sure how to best fix it. There were two simple options and neither worked. The correct approach would be to not tie the model (binary tree of panes) to the animations but fixing that is not an option for a hotfix.