summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 00:20:41 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 00:20:41 +0000
commita8eafdece6914c815d2855d21df582bc5803506b (patch)
treea7f6cd5acfd986c26b56ca8fc229602a5f6270f6
parent3d47a26aed8fd135280d4924d9e9bb36cb624946 (diff)
downloadchromium_src-a8eafdece6914c815d2855d21df582bc5803506b.zip
chromium_src-a8eafdece6914c815d2855d21df582bc5803506b.tar.gz
chromium_src-a8eafdece6914c815d2855d21df582bc5803506b.tar.bz2
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
-rw-r--r--remoting/jingle_glue/jingle_client.cc6
1 files changed, 5 insertions, 1 deletions
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.