diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-14 23:47:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-14 23:47:38 +0000 |
commit | 88f33312efe703fdb349afdcf4dc6d3c9147c033 (patch) | |
tree | c732cb56bf8bd0a4db0257e96c433fcb714fec81 /base/thread.h | |
parent | 34268cafec75687b9f504a19f5279c1dfdec986b (diff) | |
download | chromium_src-88f33312efe703fdb349afdcf4dc6d3c9147c033.zip chromium_src-88f33312efe703fdb349afdcf4dc6d3c9147c033.tar.gz chromium_src-88f33312efe703fdb349afdcf4dc6d3c9147c033.tar.bz2 |
Fix a flaky crash in Thread by guarding access to message_loop_ more carefully.
There was a window when message_loop_ could be non-NULL and invalid. The code
assumed that when message_loop_ is non-NULL, it's valid. Added a stopping_
flag which indicates a state in which we shouldn't access the message loop
because it is not safe.
Also, reused StopSoon logic in Stop and fixed a comment which was inaccurate.
TEST=Covered by base_unittests.
BUG=15331
Review URL: http://codereview.chromium.org/201108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/thread.h')
-rw-r--r-- | base/thread.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/base/thread.h b/base/thread.h index 36daa7f..1f2690c 100644 --- a/base/thread.h +++ b/base/thread.h @@ -135,6 +135,10 @@ class Thread : PlatformThread::Delegate { // started the thread. This way we know that we need to call Join. bool thread_was_started() const { return startup_data_ != NULL; } + // If true, we're in the middle of stopping, and shouldn't access + // |message_loop_|. It may non-NULL and invalid. + bool stopping_; + // Used to pass data to ThreadMain. struct StartupData; StartupData* startup_data_; |