summaryrefslogtreecommitdiffstats
path: root/base/scoped_observer.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-05 16:01:57 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-05 16:01:57 +0000
commitd725b2cc67bd9c2aa903c613a0d9d5f903cafe9c (patch)
tree98a45cdd98d988a451aa94984f8877083a055b12 /base/scoped_observer.h
parent45097a03e85213a5aabfeaf3a4a4106c2aeffc23 (diff)
downloadchromium_src-d725b2cc67bd9c2aa903c613a0d9d5f903cafe9c.zip
chromium_src-d725b2cc67bd9c2aa903c613a0d9d5f903cafe9c.tar.gz
chromium_src-d725b2cc67bd9c2aa903c613a0d9d5f903cafe9c.tar.bz2
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
Diffstat (limited to 'base/scoped_observer.h')
-rw-r--r--base/scoped_observer.h10
1 files changed, 9 insertions, 1 deletions
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_;