Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: remoting/jingle_glue/xmpp_signal_strategy.cc

Issue 10850008: Fix destruction order in XmppSignalStrategy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/jingle_glue/xmpp_signal_strategy.cc
diff --git a/remoting/jingle_glue/xmpp_signal_strategy.cc b/remoting/jingle_glue/xmpp_signal_strategy.cc
index 5179aa1fab17be7c76fbe69e7e8f5855ad12c228..c31d32398f7eaff5a38da7979df162a4fd0bc135 100644
--- a/remoting/jingle_glue/xmpp_signal_strategy.cc
+++ b/remoting/jingle_glue/xmpp_signal_strategy.cc
@@ -5,8 +5,11 @@
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
#include "base/bind.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
#include "base/string_util.h"
+#include "base/thread_task_runner_handle.h"
#include "jingle/glue/chrome_async_socket.h"
#include "jingle/glue/task_pump.h"
#include "jingle/glue/xmpp_client_socket_factory.h"
@@ -55,6 +58,12 @@ XmppSignalStrategy::XmppSignalStrategy(
XmppSignalStrategy::~XmppSignalStrategy() {
Disconnect();
+
+ // Destroying task runner will destroy XmppClient, but XmppClient may be on
+ // the stack and it doesn't handle this case properly, so we need to delay
+ // destruction.
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
+ FROM_HERE, task_runner_.release());
}
void XmppSignalStrategy::Connect() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698