mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-18 01:39:55 +00:00
[ainulindale] fix defterm
Each page was registering as a handoff target, so basically we'd start the server then yeet the connection back to the first window and presto, you'd have a dead window and a connection on the wrong thread and everything was awful. Instead, only register as the handoff listener when we've actually said we want to be a handoff listener.
This commit is contained in:
@@ -228,9 +228,6 @@ namespace winrt::TerminalApp::implementation
|
||||
// Hookup our event handlers to the ShortcutActionDispatch
|
||||
_RegisterActionCallbacks();
|
||||
|
||||
// Hook up inbound connection event handler
|
||||
ConptyConnection::NewConnection({ this, &TerminalPage::_OnNewConnection });
|
||||
|
||||
//Event Bindings (Early)
|
||||
_newTabButton.Click([weakThis{ get_weak() }](auto&&, auto&&) {
|
||||
if (auto page{ weakThis.get() })
|
||||
@@ -519,6 +516,9 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
_shouldStartInboundListener = false;
|
||||
|
||||
// Hook up inbound connection event handler
|
||||
_newConnectionRevoker = ConptyConnection::NewConnection(winrt::auto_revoke, { this, &TerminalPage::_OnNewConnection });
|
||||
|
||||
try
|
||||
{
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection::StartInboundListener();
|
||||
@@ -3326,6 +3326,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
HRESULT TerminalPage::_OnNewConnection(const ConptyConnection& connection)
|
||||
{
|
||||
_newConnectionRevoker.revoke();
|
||||
|
||||
// We need to be on the UI thread in order for _OpenNewTab to run successfully.
|
||||
// HasThreadAccess will return true if we're currently on a UI thread and false otherwise.
|
||||
// When we're on a COM thread, we'll need to dispatch the calls to the UI thread
|
||||
|
||||
@@ -226,6 +226,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
PaneResources _paneResources;
|
||||
|
||||
winrt::Microsoft::Terminal::TerminalConnection::ConptyConnection::NewConnection_revoker _newConnectionRevoker;
|
||||
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult>
|
||||
_ShowDialogHelper(const std::wstring_view& name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user