summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/location_bar
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-10 09:14:48 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-10 09:14:48 +0000
commitd57d13a6fbea0fc868f8a334857e228989cfbfdf (patch)
tree5f75615b9586493acbc08a74537063d033b2d54a /chrome/browser/cocoa/location_bar
parent88fc983023fd50fc762137f594c7198ff07889ff (diff)
downloadchromium_src-d57d13a6fbea0fc868f8a334857e228989cfbfdf.zip
chromium_src-d57d13a6fbea0fc868f8a334857e228989cfbfdf.tar.gz
chromium_src-d57d13a6fbea0fc868f8a334857e228989cfbfdf.tar.bz2
The test exposed similar problems on Linux and Mac as I fixed on Windows.
The test was failing because we get a call to UpdatePageActions while we are in the process of creating PageActions, which leads to an infinite loop (create vector, add page action, update page actions, delete vector, create vector, ...). BUG=58141 TEST=ExtensionApiTest.TestCrash57333 Review URL: http://codereview.chromium.org/3632001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/location_bar')
-rw-r--r--chrome/browser/cocoa/location_bar/page_action_decoration.mm12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/cocoa/location_bar/page_action_decoration.mm
index 337cd2f..572a65a 100644
--- a/chrome/browser/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/cocoa/location_bar/page_action_decoration.mm
@@ -32,7 +32,7 @@ PageActionDecoration::PageActionDecoration(
LocationBarViewMac* owner,
Profile* profile,
ExtensionAction* page_action)
- : owner_(owner),
+ : owner_(NULL),
profile_(profile),
page_action_(page_action),
tracker_(this),
@@ -59,6 +59,10 @@ PageActionDecoration::PageActionDecoration(
registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE,
Source<Profile>(profile_));
+
+ // We set the owner last of all so that we can determine whether we are in
+ // the process of initializing this class or not.
+ owner_ = owner;
}
PageActionDecoration::~PageActionDecoration() {}
@@ -118,7 +122,11 @@ void PageActionDecoration::OnImageLoaded(
page_action_icons_[page_action_->default_icon_path()] = *image;
}
- owner_->UpdatePageActions();
+ // If we have no owner, that means this class is still being constructed and
+ // we should not UpdatePageActions, since it leads to the PageActions being
+ // destroyed again and new ones recreated (causing an infinite loop).
+ if (owner_)
+ owner_->UpdatePageActions();
}
void PageActionDecoration::UpdateVisibility(TabContents* contents,