From a8eafdece6914c815d2855d21df582bc5803506b Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Wed, 23 Jun 2010 00:20:41 +0000 Subject: Small fix to jingle_glue for chromoting Allow JingleClient to be closed more than once and before it is initalized. If JingleClient is disconnected from the talk network due to reaons like invalid credentials, user of JingleClient will attempt to close the client again resulting a crash in libjingle. Instead of failing aggressive we allow the close operation to be more flexible and handle the invalid cases internally. TEST=none BUG=none Review URL: http://codereview.chromium.org/2819017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50551 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/jingle_glue/jingle_client.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'remoting') diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc index 05d7fd3..415932c 100644 --- a/remoting/jingle_glue/jingle_client.cc +++ b/remoting/jingle_glue/jingle_client.cc @@ -84,7 +84,11 @@ void JingleClient::Close() { void JingleClient::DoClose() { DCHECK_EQ(message_loop(), MessageLoop::current()); - DCHECK(callback_ != NULL); // Close() should only be called after Init(). + + // If we have not yet initialized and the client is already closed then + // don't close again. + if (!callback_ || state_ == CLOSED) + return; client_->Disconnect(); // Client is deleted by TaskRunner. -- cgit v1.1