summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 00:13:40 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 00:13:40 +0000
commit3e2808e92be4c6769cb51a8dbe4c06191c073f17 (patch)
treea9d2a7178afc04944ec5fd632133867851cb4ec3 /remoting
parent5fa4027dd7965e12897c66c907134ba0a96ec676 (diff)
downloadchromium_src-3e2808e92be4c6769cb51a8dbe4c06191c073f17.zip
chromium_src-3e2808e92be4c6769cb51a8dbe4c06191c073f17.tar.gz
chromium_src-3e2808e92be4c6769cb51a8dbe4c06191c073f17.tar.bz2
Fix crash in XmppSignalStrategy.
XmppClient destroys itself when connection is closed. Session objects are destroyed later and may still try to send a message. XmppSignalStrategy didn't handle this case properly. BUG=100733 TEST=See repro steps in the bug. Review URL: http://codereview.chromium.org/8344006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/jingle_glue/xmpp_signal_strategy.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/remoting/jingle_glue/xmpp_signal_strategy.cc b/remoting/jingle_glue/xmpp_signal_strategy.cc
index 3a7da5a..63d372a 100644
--- a/remoting/jingle_glue/xmpp_signal_strategy.cc
+++ b/remoting/jingle_glue/xmpp_signal_strategy.cc
@@ -77,14 +77,26 @@ void XmppSignalStrategy::SetListener(Listener* listener) {
}
void XmppSignalStrategy::SendStanza(buzz::XmlElement* stanza) {
+ if (!xmpp_client_) {
+ LOG(INFO) << "Dropping signalling message because XMPP "
+ "connection has been terminated.";
+ return;
+ }
xmpp_client_->SendStanza(stanza);
}
std::string XmppSignalStrategy::GetNextId() {
+ if (!xmpp_client_) {
+ // If the connection has been terminated then it doesn't matter
+ // what Id we return.
+ return "";
+ }
return xmpp_client_->NextId();
}
IqRequest* XmppSignalStrategy::CreateIqRequest() {
+ // TODO(sergeyu): Handle the case when |xmpp_client_| is NULL.
+ CHECK(xmpp_client_);
return new XmppIqRequest(thread_->message_loop(), xmpp_client_);
}