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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_action_button.mm

Issue 967883006: [Extensions Toolbar Mac] Fix crash in browser action context menus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/browser_action_button.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
index f92dfd72ec4926aa0e09e82d24d32e21aa65b1d2..393c33b663d7593421abfe1766d1c31d3af955c1 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
@@ -411,6 +411,9 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
// We only need to do this because in Cocoa's memory management, removing the
// button from the toolbar doesn't synchronously dealloc it.
viewControllerDelegate_.reset();
+ // Also reset the context menu, since it has a dependency on the backing
+ // controller (which owns its model).
+ contextMenuController_.reset();
}
- (BOOL)isAnimating {
@@ -465,6 +468,9 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
if (testContextMenu_)
return testContextMenu_;
+ // Make sure we delete any references to an old menu.
+ contextMenuController_.reset();
+
ui::MenuModel* contextMenu = viewController_->GetContextMenu();
if (!contextMenu)
return nil;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698