Close the TermControl when closing a TerminalPaneContent (#19657)

This fixes an issue where calling close on a tab/pane won't
raise a StateChange notification on the connection.
This commit is contained in:
Leonard Hecker
2025-12-17 19:19:15 +01:00
committed by GitHub
parent f321c30cc1
commit a79078924a

View File

@@ -66,8 +66,12 @@ namespace winrt::TerminalApp::implementation
}
void TerminalPaneContent::Close()
{
// We deliberately remove the event handlers before closing the control.
// This is to prevent reentrancy issues, pointless callbacks, etc.
_removeControlEvents();
_control.Close();
// Clear out our media player callbacks, and stop any playing media. This
// will prevent the callback from being triggered after we've closed, and
// also make sure that our sound stops when we're closed.