Index: chrome/browser/notifications/message_center_notification_manager.cc |
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc |
index 7b991f039890df7414e93dc747987769897d9d13..b032ec2ee8639f90e1f1edf1db2922e3d6bb84eb 100644 |
--- a/chrome/browser/notifications/message_center_notification_manager.cc |
+++ b/chrome/browser/notifications/message_center_notification_manager.cc |
@@ -145,10 +145,12 @@ bool MessageCenterNotificationManager::Update(const Notification& notification, |
// Add/remove notification in the local list but just update the same |
// one in MessageCenter. |
- delete old_notification; |
- profile_notifications_.erase(old_id); |
ProfileNotification* new_notification = |
new ProfileNotification(profile, notification); |
+ // Delete the old one after the new one is created to ensure we don't run |
+ // out of KeepAlives. |
+ delete old_notification; |
+ profile_notifications_.erase(old_id); |
profile_notifications_[new_notification->notification().id()] = |
new_notification; |