Commit 00475fa5 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Fix a race condition bug of input_stub

When a connection is closed by the host, ChromotingClient will first
get the notification on network thread, then free the connection object
and notify UI components on the UI thread. In some rare situations,
a mouse event may be posted to the network thread after the connection
is reset and before ChromotingSession starts cleaning up resources, and
causes segfault because the input_stub is already freed by the
connection.

This CL fixes this problem by immediately resetting the input_stub when
the connection is being reset.

Bug: 766698
Change-Id: I95d230565154dfe3762b9de516f5fa02dabb2bba
Reviewed-on: https://chromium-review.googlesource.com/683801Reviewed-by: default avatarScott Nichols <nicholss@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504443}
parent bd0ce634
......@@ -243,6 +243,7 @@ void ChromotingClient::OnSignalStrategyStateChange(
}
} else if (state == SignalStrategy::DISCONNECTED) {
VLOG(1) << "Signaling connection closed.";
mouse_input_scaler_.set_input_stub(nullptr);
connection_.reset();
user_interface_->OnConnectionState(protocol::ConnectionToHost::CLOSED,
protocol::SIGNALING_ERROR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment