diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-03 18:15:16 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-03 18:15:16 +0000 |
commit | 821f5033f67770169280954bc87f501f4ae67203 (patch) | |
tree | 953f840d770ad850d4c50324e21c5202d7db259c /base/observer_list_threadsafe.h | |
parent | 1e311fd47619432954254cdf442eb743748d371f (diff) | |
download | chromium_src-821f5033f67770169280954bc87f501f4ae67203.zip chromium_src-821f5033f67770169280954bc87f501f4ae67203.tar.gz chromium_src-821f5033f67770169280954bc87f501f4ae67203.tar.bz2 |
The base unittests were succeeding for the isolated
tests, but failed when all tests were run because
some tests run without a message loop. The
observer_list_threadsafe allowed AddObserver to run
with null message loops. But, if you call Notify
after doing so, then the notify call would attempt
to use the registered "null" ptr to a message loop.
This crashed, of course.
Review URL: http://codereview.chromium.org/9045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/observer_list_threadsafe.h')
-rw-r--r-- | base/observer_list_threadsafe.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index f76f063..113805f 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -64,6 +64,8 @@ class ObserverListThreadSafe : void AddObserver(ObserverType* obs) { ObserverList<ObserverType>* list = NULL; MessageLoop* loop = MessageLoop::current(); + if (!loop) + return; // Some unittests may access this without a message loop. { AutoLock lock(list_lock_); if (observer_lists_.find(loop) == observer_lists_.end()) |