Skip to content

Commit

Permalink
Fix single-tab window tear-off crash (#17251)
Browse files Browse the repository at this point in the history
## Validation Steps Performed
- Opened multi-tab terminal window with Narrator. Narrator can read
characters from the tabs.
- Started a drag and drop (tear-off) of a tab, and it didn't crash. This
was repeated multiple times.
  • Loading branch information
tusharsnx authored May 13, 2024
1 parent 5ce7fb7 commit 30ef1f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// MSFT 33353327: We're purposefully not using _initializedTerminal to ensure we're fully initialized.
// Doing so makes us return nullptr when XAML requests an automation peer.
// Instead, we need to give XAML an automation peer, then fix it later.
if (!_IsClosing())
if (!_IsClosing() && !_detached)
{
// It's unexpected that interactivity is null even when we're not closing or in detached state.
THROW_HR_IF_NULL(E_UNEXPECTED, _interactivity);

// create a custom automation peer with this code pattern:
// (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers)
if (const auto& interactivityAutoPeer{ _interactivity.OnCreateAutomationPeer() })
Expand Down

0 comments on commit 30ef1f4

Please sign in to comment.