From d725b2cc67bd9c2aa903c613a0d9d5f903cafe9c Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Fri, 5 Oct 2012 16:01:57 +0000 Subject: Fix crash in a few of the tests in content_browsertests on Linux. The problem was that DesktopActivationClient would be created after an aura::Window so it would never register for notifications that it went away. As a result it would call a deleted Window in its ActivateWindow method. BUG=146077 Review URL: https://codereview.chromium.org/11062004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160386 0039d316-1c4b-4281-b951-d872f2087c98 --- base/scoped_observer.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'base/scoped_observer.h') diff --git a/base/scoped_observer.h b/base/scoped_observer.h index fdc9de3..eae63672 100644 --- a/base/scoped_observer.h +++ b/base/scoped_observer.h @@ -29,12 +29,20 @@ class ScopedObserver { source->AddObserver(observer_); } - // Removse the object passed to the constructor as an observer from |source|. + // Remove the object passed to the constructor as an observer from |source|. void Remove(Source* source) { sources_.erase(std::find(sources_.begin(), sources_.end(), source)); source->RemoveObserver(observer_); } + bool IsObserving(Source* source) const { + for (size_t i = 0; i < sources_.size(); ++i) { + if (sources_[i] == source) + return true; + } + return false; + } + private: Observer* observer_; -- cgit v1.1