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

Unified Diff: chrome/browser/ui/views/browser_action_view.cc

Issue 10826262: Fixed Issue 141873. Crash when BrowserActionButton get disabled or hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Issue 141873 Created 8 years, 4 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/ui/views/browser_action_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/browser_action_view.cc
diff --git a/chrome/browser/ui/views/browser_action_view.cc b/chrome/browser/ui/views/browser_action_view.cc
index f4275e6ecce2a2a2f2f753ce2bb2b23b576b4c11..787a35091252dda316409a60abd5f578b1c59d46 100644
--- a/chrome/browser/ui/views/browser_action_view.cc
+++ b/chrome/browser/ui/views/browser_action_view.cc
@@ -62,6 +62,7 @@ BrowserActionView::BrowserActionView(const Extension* extension,
}
BrowserActionView::~BrowserActionView() {
+ button_->Destroy();
}
gfx::Canvas* BrowserActionView::GetIconWithBadge() {
@@ -82,7 +83,7 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() {
return canvas;
}
-
+
void BrowserActionView::Layout() {
// We can't rely on button_->GetPreferredSize() here because that's not set
// correctly until the first call to
@@ -96,16 +97,16 @@ void BrowserActionView::Layout() {
BrowserActionsContainer::IconHeight());
}
-void BrowserActionView::ViewHierarchyChanged(bool is_add,
- View* parent,
- View* child) {
- if (is_add && (child == this)) {
- button_ = new BrowserActionButton(extension_, browser_, delegate_);
- button_->set_drag_controller(delegate_);
-
- AddChildView(button_);
- button_->UpdateState();
- }
+void BrowserActionView::ViewHierarchyChanged(bool is_add,
+ View* parent,
+ View* child) {
+ if (is_add && (child == this) && (GetWidget() != NULL) && (button_ == NULL)) {
+ button_ = new BrowserActionButton(extension_, browser_, delegate_);
+ button_->set_drag_controller(delegate_);
+ button_->set_owned_by_client();
+ AddChildView(button_);
+ button_->UpdateState();
+ }
}
void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) {
« no previous file with comments | « chrome/browser/ui/views/browser_action_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698