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

Unified Diff: chrome/browser/dom_ui/options/options_ui.cc

Issue 6291012: Prevent double inialization of DOMUI pref handlers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bump copyright Created 9 years, 11 months 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 | « chrome/browser/dom_ui/options/options_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/options/options_ui.cc
diff --git a/chrome/browser/dom_ui/options/options_ui.cc b/chrome/browser/dom_ui/options/options_ui.cc
index ffd8d78ac73ffff9dfbc54ea85c93a4a5b2ef049..26f0fbe2c15c1d618bf408da846590d458a3982a 100644
--- a/chrome/browser/dom_ui/options/options_ui.cc
+++ b/chrome/browser/dom_ui/options/options_ui.cc
@@ -135,7 +135,8 @@ void OptionsPageUIHandler::UserMetricsRecordAction(
//
////////////////////////////////////////////////////////////////////////////////
-OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
+OptionsUI::OptionsUI(TabContents* contents)
+ : DOMUI(contents), initialized_handlers_(false) {
DictionaryValue* localized_strings = new DictionaryValue();
#if defined(OS_CHROMEOS)
@@ -258,6 +259,14 @@ RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
void OptionsUI::InitializeHandlers() {
DCHECK(!GetProfile()->IsOffTheRecord());
+ // The reinitialize call from DidBecomeActiveForReusedRenderView end up being
+ // delivered after a new web page DOM has been brought up in an existing
+ // renderer (due to IPC delays), causing this method to be called twice. If
+ // that happens, ignore the second call.
+ if (initialized_handlers_)
+ return;
+ initialized_handlers_ = true;
+
std::vector<DOMMessageHandler*>::iterator iter;
// Skip over the generic handler.
for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) {
« no previous file with comments | « chrome/browser/dom_ui/options/options_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698