diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 21:53:52 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 21:53:52 +0000 |
commit | 6ad9e38d19aeef21882708deec510fd34516a82b (patch) | |
tree | 56f5b077ecbe88033fe6368ffbedcb3d99cffa62 /chrome | |
parent | 5367dbc12dd614275b121dd239e97e606c197517 (diff) | |
download | chromium_src-6ad9e38d19aeef21882708deec510fd34516a82b.zip chromium_src-6ad9e38d19aeef21882708deec510fd34516a82b.tar.gz chromium_src-6ad9e38d19aeef21882708deec510fd34516a82b.tar.bz2 |
Add a CHECK for NULL observers. I got a NULL pointer exception when notifying
on a notification, which is impossible to track down since I don't know who
added it.
Review URL: http://codereview.chromium.org/20502
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/notification_service.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/common/notification_service.cc b/chrome/common/notification_service.cc index 5b732df..5a9fa72 100644 --- a/chrome/common/notification_service.cc +++ b/chrome/common/notification_service.cc @@ -35,6 +35,13 @@ void NotificationService::AddObserver(NotificationObserver* observer, const NotificationSource& source) { DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT); + // We have gotten some crashes where the observer pointer is NULL. The problem + // is that this happens when we actually execute a notification, so have no + // way of knowing who the bad observer was. We want to know when this happens + // in release mode so we know what code to blame the crash on (since this is + // guaranteed to crash later). + CHECK(observer); + NotificationObserverList* observer_list; if (HasKey(observers_[type.value], source)) { observer_list = observers_[type.value][source.map_key()]; |