From 821f5033f67770169280954bc87f501f4ae67203 Mon Sep 17 00:00:00 2001 From: "mbelshe@google.com" Date: Mon, 3 Nov 2008 18:15:16 +0000 Subject: 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 --- base/observer_list_threadsafe.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'base/observer_list_threadsafe.h') 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* 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()) -- cgit v1.1