From a9fc5b295a15a1fc19b72d41e641380c7af3e00d Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Tue, 29 Nov 2011 04:01:43 +0000 Subject: Don't delete channels in JingleSession::CloseInternal(). Channel creators should be destroyed using CancelChannelCreation(). Previously the code was crashing in CancelChannelCreation() when trying to delete an object that has already been deleted. BUG=105035 Review URL: http://codereview.chromium.org/8726018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111866 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/protocol/jingle_session.cc | 4 +--- remoting/protocol/session.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 21f8426..ef0dfad 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -71,6 +71,7 @@ JingleSession::~JingleSession() { state_change_callback_.Reset(); Close(); jingle_session_manager_->SessionDestroyed(this); + DCHECK(channel_connectors_.empty()); } void JingleSession::Init(cricket::Session* cricket_session) { @@ -90,9 +91,6 @@ void JingleSession::CloseInternal(int result, Error error) { if (state_ != FAILED && state_ != CLOSED && !closing_) { closing_ = true; - STLDeleteContainerPairSecondPointers(channel_connectors_.begin(), - channel_connectors_.end()); - // Tear down the cricket session, including the cricket transport channels. if (cricket_session_) { std::string reason; diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h index 603f733..346fb28 100644 --- a/remoting/protocol/session.h +++ b/remoting/protocol/session.h @@ -88,7 +88,8 @@ class Session : public base::NonThreadSafe { // Cancels a pending CreateStreamChannel() or CreateDatagramChannel() // operation for the named channel. If the channel creation already - // completed then cancelling it has no effect. + // completed then cancelling it has no effect. When shutting down + // this method must be called for each channel pending creation. virtual void CancelChannelCreation(const std::string& name) = 0; // JID of the other side. -- cgit v1.1