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

Unified Diff: chrome/browser/cocoa/history_menu_bridge.h

Issue 2836008: Make the HistoryMenuBridge::HistoryItem co-own the NSMenuItem. This hopefully fixes a top-crash. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 6 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
Index: chrome/browser/cocoa/history_menu_bridge.h
diff --git a/chrome/browser/cocoa/history_menu_bridge.h b/chrome/browser/cocoa/history_menu_bridge.h
index ef84031876ffeae739fc29cf1dbf2577c9e74c87..b02b75a18f78ee30ccc1bad43e918a220a80e9e3 100644
--- a/chrome/browser/cocoa/history_menu_bridge.h
+++ b/chrome/browser/cocoa/history_menu_bridge.h
@@ -88,8 +88,12 @@ class HistoryMenuBridge : public NotificationObserver,
// The Handle given to us by the FaviconService for the icon fetch request.
FaviconService::Handle icon_handle;
- // The pointer to the item after it has been created. Weak.
- NSMenuItem* menu_item;
+ // The pointer to the item after it has been created. This is co-owned with
+ // the NSMenu, but during a rebuild flood (if the user closes a lot of tabs
John Grabowski 2010/06/17 19:30:44 This is co-owned with the NSMenu. but ... --> Str
+ // quickly), the NSMenu can release the item before the HistoryItem has
+ // been fully deleted. If this were a weak pointer, it would result in a
+ // zombie.
+ scoped_nsobject<NSMenuItem> menu_item;
// This ID is unique for a browser session and can be passed to the
// TabRestoreService to re-open the closed window or tab that this
« no previous file with comments | « no previous file | chrome/browser/cocoa/history_menu_bridge.mm » ('j') | chrome/browser/cocoa/history_menu_bridge.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698