summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 17:29:33 +0000
committerzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 17:29:33 +0000
commit85d6e6a5c53f1b6cb246a4c12ce3601921c96c1e (patch)
tree5b013bc5d30d7aa301dae4f8950e372a018d6d30
parentcc2c343ff3ef0e546c6a4788c182d29b4f8341eb (diff)
downloadchromium_src-85d6e6a5c53f1b6cb246a4c12ce3601921c96c1e.zip
chromium_src-85d6e6a5c53f1b6cb246a4c12ce3601921c96c1e.tar.gz
chromium_src-85d6e6a5c53f1b6cb246a4c12ce3601921c96c1e.tar.bz2
Fix the mediator thread to check for a valid xmpp client before trying to
process commands. This fixes the problem where the auto-reconnect posts a login command just after the client connects, just before a listen for updates command is posted. BUG=24245 TEST=Send a CMD_LISTEN_FOR_UPDATES immediately after the CMD_LOGIN in MediatorThreadImpl::Login() Chromium will no longer crash. Review URL: http://codereview.chromium.org/372011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31242 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/notifier/listener/mediator_thread_impl.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc b/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc
index 34026c7..0934daf 100644
--- a/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc
+++ b/chrome/browser/sync/notifier/listener/mediator_thread_impl.cc
@@ -205,7 +205,12 @@ void MediatorThreadImpl::DoDisconnect() {
}
void MediatorThreadImpl::DoSubscribeForUpdates() {
- SubscribeTask* subscription = new SubscribeTask(xmpp_client());
+ buzz::XmppClient* client = xmpp_client();
+ // If there isn't an active xmpp client, return.
+ if (!client) {
+ return;
+ }
+ SubscribeTask* subscription = new SubscribeTask(client);
subscription->SignalStatusUpdate.connect(
this,
&MediatorThreadImpl::OnSubscriptionStateChange);
@@ -213,7 +218,12 @@ void MediatorThreadImpl::DoSubscribeForUpdates() {
}
void MediatorThreadImpl::DoListenForUpdates() {
- ListenTask* listener = new ListenTask(xmpp_client());
+ buzz::XmppClient* client = xmpp_client();
+ // If there isn't an active xmpp client, return.
+ if (!client) {
+ return;
+ }
+ ListenTask* listener = new ListenTask(client);
listener->SignalUpdateAvailable.connect(
this,
&MediatorThreadImpl::OnUpdateListenerMessage);
@@ -221,7 +231,12 @@ void MediatorThreadImpl::DoListenForUpdates() {
}
void MediatorThreadImpl::DoSendNotification() {
- SendUpdateTask* task = new SendUpdateTask(xmpp_client());
+ buzz::XmppClient* client = xmpp_client();
+ // If there isn't an active xmpp client, return.
+ if (!client) {
+ return;
+ }
+ SendUpdateTask* task = new SendUpdateTask(client);
task->SignalStatusUpdate.connect(
this,
&MediatorThreadImpl::OnUpdateNotificationSent);