summaryrefslogtreecommitdiffstats
path: root/base/observer_list_threadsafe.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/observer_list_threadsafe.h')
-rw-r--r--base/observer_list_threadsafe.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index fcfa0ed..f76f063 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -81,11 +81,15 @@ class ObserverListThreadSafe :
void RemoveObserver(ObserverType* obs) {
ObserverList<ObserverType>* list = NULL;
MessageLoop* loop = MessageLoop::current();
+ if (!loop)
+ return; // On shutdown, it is possible that current() is already null.
{
AutoLock lock(list_lock_);
- DCHECK(observer_lists_.find(loop) != observer_lists_.end()) <<
- "RemoveObserver called on for unknown thread";
list = observer_lists_[loop];
+ if (!list) {
+ NOTREACHED() << "RemoveObserver called on for unknown thread";
+ return;
+ }
// If we're about to remove the last observer from the list,
// then we can remove this observer_list entirely.