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

Unified Diff: tools/android/forwarder2/device_forwarder_main.cc

Issue 1571643003: Fix crash in device_forwarder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: tools/android/forwarder2/device_forwarder_main.cc
diff --git a/tools/android/forwarder2/device_forwarder_main.cc b/tools/android/forwarder2/device_forwarder_main.cc
index fdf5fe54a54a0a8fd9453cdb6af0e349ab91ebbe..09790f98b5f90fc5bea5dbbd6280ba2aca233cd2 100644
--- a/tools/android/forwarder2/device_forwarder_main.cc
+++ b/tools/android/forwarder2/device_forwarder_main.cc
@@ -52,19 +52,9 @@ class ServerDelegate : public Daemon::ServerDelegate {
if (!controller_thread_.get())
return;
// The DeviceController instance, if any, is constructed on the controller
- // thread. Make sure that it gets deleted on that same thread. Note that
- // DeleteSoon() is not used here since it would imply reading |controller_|
jbudorick 2016/01/08 21:41:08 I hadn't reviewed yet because I'd like to look int
Xianzhu 2016/01/08 21:47:03 I don't think the previous comment is correct. The
jbudorick 2016/01/08 22:11:37 It looks like the original would avoid that risk b
- // from the main thread while it's set on the internal thread.
- controller_thread_->task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&ServerDelegate::DeleteControllerOnInternalThread,
- base::Unretained(this)));
- }
-
- void DeleteControllerOnInternalThread() {
- DCHECK(
- controller_thread_->task_runner()->RunsTasksOnCurrentThread());
- controller_.reset();
+ // thread. Make sure that it gets deleted on that same thread.
+ controller_thread_->task_runner()->DeleteSoon(
+ FROM_HERE, controller_.release());
}
// Daemon::ServerDelegate:
« 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