Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
index 24cf4b44954e26ec93f1dd3ddb2039215c8cbf5e..78e915cfe320e8a7a1b68fe8b5a35d89ea87d897 100644 |
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc |
@@ -394,8 +394,12 @@ BookmarkBarView::~BookmarkBarView() { |
// It's possible for the menu to outlive us, reset the observer to make sure |
// it doesn't have a reference to us. |
- if (bookmark_menu_) |
+ if (bookmark_menu_) { |
bookmark_menu_->set_observer(NULL); |
+ bookmark_menu_->SetPageNavigator(NULL); |
+ } |
+ if (context_menu_.get()) |
+ context_menu_->SetPageNavigator(NULL); |
StopShowFolderDropMenuTimer(); |
@@ -405,6 +409,10 @@ BookmarkBarView::~BookmarkBarView() { |
void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { |
page_navigator_ = navigator; |
+ if (bookmark_menu_) |
+ bookmark_menu_->SetPageNavigator(navigator); |
+ if (context_menu_.get()) |
+ context_menu_->SetPageNavigator(navigator); |
} |
void BookmarkBarView::SetBookmarkBarState( |
@@ -1097,9 +1105,9 @@ void BookmarkBarView::ShowContextMenuForView(View* source, |
bool close_on_remove = |
(parent == profile->GetBookmarkModel()->other_node()) && |
(parent->child_count() == 1); |
- BookmarkContextMenu controller(GetWidget(), profile, |
- browser_->GetSelectedTabContents(), parent, nodes, close_on_remove); |
- controller.RunMenuAt(p); |
+ context_menu_.reset(new BookmarkContextMenu(GetWidget(), profile, |
+ browser_->GetSelectedTabContents(), parent, nodes, close_on_remove)); |
+ context_menu_->RunMenuAt(p); |
} |
void BookmarkBarView::Observe(int type, |