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

Unified Diff: base/message_loop/message_pump_perftest.cc

Issue 1283543007: Prevent a thread startup race in ScheduleWorkTest which causes a nullptr dereference of a message p… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: base/message_loop/message_pump_perftest.cc
diff --git a/base/message_loop/message_pump_perftest.cc b/base/message_loop/message_pump_perftest.cc
index 7d833befa6158a33b5e64810a928c85abf547798..9f76064ce38e4c586dcb0db1fd5bd1b406ec5da7 100644
--- a/base/message_loop/message_pump_perftest.cc
+++ b/base/message_loop/message_pump_perftest.cc
@@ -70,6 +70,13 @@ class ScheduleWorkTest : public testing::Test {
{
target_.reset(new Thread("target"));
target_->StartWithOptions(Thread::Options(target_type, 0u));
+
+ // Without this, it's possible for the scheduling threads to start and run
+ // before the target thread. In this case, the scheduling threads will
+ // call target_message_loop()->ScheduleWork(), which dereferences the
+ // loop's message pump, which is only created after the target thread has
+ // finished starting.
+ target_->WaitUntilThreadStarted();
}
ScopedVector<Thread> scheduling_threads;
« 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