Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: chrome/common/notification_service.cc

Issue 342091: Add a CHECK when an object tries to remove itself as an observer from Notific... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/notification_service.cc
===================================================================
--- chrome/common/notification_service.cc (revision 30793)
+++ chrome/common/notification_service.cc (working copy)
@@ -60,8 +60,15 @@
NotificationType type,
const NotificationSource& source) {
DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT);
- DCHECK(HasKey(observers_[type.value], source));
+ // This is a very serious bug. An object is most likely being deleted on
+ // the wrong thread, and as a result another thread's NotificationService
+ // has its deleted pointer in its map. A garbge object will be called in the
+ // future.
+ // NOTE: when this check shows crashes, use ChromeThread::DeleteOnIOThread or
+ // other variants as the trait on the object.
+ CHECK(HasKey(observers_[type.value], source));
+
NotificationObserverList* observer_list =
observers_[type.value][source.map_key()];
if (observer_list) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698