summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoramistry <amistry@chromium.org>2015-08-10 16:50:44 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-10 23:51:24 +0000
commit7fc519fa5164f2eb7c718de2d0ed7500e11fc690 (patch)
tree7c137d6cddd93f9ca36a1a9126a3cfe5f7604d37 /base
parentbb11d70c5a53bcd7b9c6ae7199fdc7e48358c783 (diff)
downloadchromium_src-7fc519fa5164f2eb7c718de2d0ed7500e11fc690.zip
chromium_src-7fc519fa5164f2eb7c718de2d0ed7500e11fc690.tar.gz
chromium_src-7fc519fa5164f2eb7c718de2d0ed7500e11fc690.tar.bz2
Prevent a thread startup race in ScheduleWorkTest which causes a nullptr dereference of a message pump.
Review URL: https://codereview.chromium.org/1283543007 Cr-Commit-Position: refs/heads/master@{#342741}
Diffstat (limited to 'base')
-rw-r--r--base/message_loop/message_pump_perftest.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/message_loop/message_pump_perftest.cc b/base/message_loop/message_pump_perftest.cc
index 7d833be..9f76064 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;