| Index: remoting/protocol/jingle_session.cc
|
| diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
|
| index f97a73ad228c5c90bc975ef055ffc9a1e04d32e1..feebe2914cfa35157034f96ebfe7295c624e1675 100644
|
| --- a/remoting/protocol/jingle_session.cc
|
| +++ b/remoting/protocol/jingle_session.cc
|
| @@ -159,7 +159,9 @@ JingleSession::JingleSession(
|
| }
|
|
|
| JingleSession::~JingleSession() {
|
| - DCHECK(closed_);
|
| + // Reset the callback so that it's not called from Close().
|
| + state_change_callback_.reset();
|
| + Close();
|
| jingle_session_manager_->SessionDestroyed(this);
|
| }
|
|
|
| @@ -447,13 +449,20 @@ void JingleSession::OnInitiate() {
|
| video_channel_.reset(
|
| new jingle_glue::TransportChannelSocketAdapter(raw_video_channel_));
|
|
|
| - if (!cricket_session_->initiator())
|
| - jingle_session_manager_->AcceptConnection(this, cricket_session_);
|
| -
|
| - if (!closed_) {
|
| - // Set state to CONNECTING if the session is being accepted.
|
| - SetState(CONNECTING);
|
| + if (!cricket_session_->initiator()) {
|
| + if (!jingle_session_manager_->AcceptConnection(this, cricket_session_)) {
|
| + Close();
|
| + // Release session so that
|
| + // JingleSessionManager::SessionDestroyed() doesn't try to call
|
| + // cricket::SessionManager::DestroySession() for it.
|
| + ReleaseSession();
|
| + delete this;
|
| + return;
|
| + }
|
| }
|
| +
|
| + // Set state to CONNECTING if the session is being accepted.
|
| + SetState(CONNECTING);
|
| }
|
|
|
| bool JingleSession::EstablishPseudoTcp(
|
|
|