Skip to content

Commit

Permalink
Control: Start the connection outside of lock (#5286)
Browse files Browse the repository at this point in the history
When the connection printed text immediately, synchronously, as part of
Start() it would cause terminal to deadlock. We should start the
connection outside of lock.

The ConptyConnection would do this when it failed to launch something
(trivial repro: `wt -- xyz`).

The TelnetConnection would do this all the time, because local loopback
telnet is fast and easy.
  • Loading branch information
DHowett authored Apr 8, 2020
1 parent 761bee8 commit 5622f23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,15 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
// becomes a no-op.
this->Focus(FocusState::Programmatic);

_connection.Start();
_initializedTerminal = true;
} // scope for TerminalLock
// call this event dispatcher outside of lock

// Start the connection outside of lock, because it could
// start writing output immediately.
_connection.Start();

// Likewise, run the event handlers outside of lock (they could
// be reentrant)
_InitializedHandlers(*this, nullptr);
return true;
}
Expand Down

0 comments on commit 5622f23

Please sign in to comment.