Skip to content

Commit

Permalink
Teach TerminalPage to handle exceptions that happen during paste (mic…
Browse files Browse the repository at this point in the history
…rosoft#5856)

Terminal should try not to join the choir invisible when the clipboard
API straight up horks it.

This accounts for ~3% of the crashes seen in 1.0RC1 and ~1% of the
crashes seen all-up in the last 14 days.

## Repro (prior to this commit)
Set `"copyOnSelect": true`.

Copy something small.

Hold down <kbd>Ctrl+Shift+V</kbd>

Double-click like your life depends on it. Double-click like you're
playing cookie clicker again. 2013 called, it wants its cookies back.

Fixes microsoft#4906.
  • Loading branch information
DHowett authored and jelster committed May 28, 2020
1 parent 8aea265 commit 60485bb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,12 +1448,16 @@ namespace winrt::TerminalApp::implementation
// will crash on the UI thread, because the main thread is a STA.
co_await winrt::resume_background();

hstring text = L"";
if (data.Contains(StandardDataFormats::Text()))
try
{
text = co_await data.GetTextAsync();
hstring text = L"";
if (data.Contains(StandardDataFormats::Text()))
{
text = co_await data.GetTextAsync();
}
eventArgs.HandleClipboardData(text);
}
eventArgs.HandleClipboardData(text);
CATCH_LOG();
}

// Method Description:
Expand Down

0 comments on commit 60485bb

Please sign in to comment.