summaryrefslogtreecommitdiffstats
path: root/chrome/browser/jsmessage_box_handler.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 04:27:05 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-06 04:27:05 +0000
commitdd5684a027e4a3b2d74cb9eeebfb039171008503 (patch)
treeb3013ab636f6fd3b86c335dd51f15e57ca35e9c3 /chrome/browser/jsmessage_box_handler.cc
parent5d244865ed539d1bf8236fbda2b316d20a24231d (diff)
downloadchromium_src-dd5684a027e4a3b2d74cb9eeebfb039171008503.zip
chromium_src-dd5684a027e4a3b2d74cb9eeebfb039171008503.tar.gz
chromium_src-dd5684a027e4a3b2d74cb9eeebfb039171008503.tar.bz2
Change all classes that use the NOTIFY_NAV_ENTRY_COMMITTED notification to use the notification registrar. This is a speculative fix for a crash I happened to catch in a debugger where the pointer was invalid when dispatching this notifcation. It could be one of these consumers is leaking it's registered observer (the TabContents is the most suspicious one).
Review URL: http://codereview.chromium.org/16519 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jsmessage_box_handler.cc')
-rw-r--r--chrome/browser/jsmessage_box_handler.cc17
1 files changed, 4 insertions, 13 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index b86920b..2a1d2fd 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -37,12 +37,6 @@ void JavascriptMessageBoxHandler::RunJavascriptMessageBox(
}
JavascriptMessageBoxHandler::~JavascriptMessageBoxHandler() {
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
- NotificationService::AllSources());
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,
- NotificationService::AllSources());
}
//////////////////////////////////////////////////////////////////////////////
@@ -209,11 +203,8 @@ JavascriptMessageBoxHandler::JavascriptMessageBoxHandler(
// Make sure we get navigation notifications so we know when our parent
// contents will disappear or navigate to a different page.
- NotificationService::current()->
- AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
- NotificationService::AllSources());
- NotificationService::current()->
- AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,
- NotificationService::AllSources());
+ registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ NotificationService::AllSources());
+ registrar_.Add(this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ NotificationService::AllSources());
}
-