Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ DELAYLOAD
DELETEONRELEASE
depersist
deprioritized
DESTROYCLIPBOARD
devicecode
Dext
DFF
Expand Down
13 changes: 12 additions & 1 deletion src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3624,8 +3624,19 @@ namespace winrt::TerminalApp::implementation
}
}

void TerminalPage::_copyToClipboard(const IInspectable, const WriteToClipboardEventArgs args) const
safe_void_coroutine TerminalPage::_copyToClipboard(const IInspectable, const WriteToClipboardEventArgs args) const
{
// This is our hook into SetCopyToClipboardCallback, which gets called by the VT parser thread.
// When this gets called, the console lock is being held. This is not a problem per-se, but there
// is just a teeny tiny problem... EmptyClipboard() sends WM_DESTROYCLIPBOARD to the previous owner.
Comment thread
lhecker marked this conversation as resolved.
Dismissed
// *We* may be the previous owner.
//
// So now we (VT thread, holding the lock) are waiting for us (UI thread, waiting for the lock)
// and immediately deadlock. *Tada* 5s app freeze.
//
// Solution: Just do it on the UI thread. Just like conhost.
co_await wil::resume_foreground(Dispatcher());

if (const auto clipboard = clipboard::open(_hostingHwnd.value_or(nullptr)))
{
const auto plain = args.Plain();
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ namespace winrt::TerminalApp::implementation

safe_void_coroutine _SetTaskbarProgressHandler(const IInspectable sender, const IInspectable eventArgs);

void _copyToClipboard(IInspectable, Microsoft::Terminal::Control::WriteToClipboardEventArgs args) const;
safe_void_coroutine _copyToClipboard(IInspectable, Microsoft::Terminal::Control::WriteToClipboardEventArgs args) const;
void _PasteText();

safe_void_coroutine _ControlNoticeRaisedHandler(const IInspectable sender, const Microsoft::Terminal::Control::NoticeEventArgs eventArgs);
Expand Down
Loading