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

Unified Diff: views/controls/menu/submenu_view.h

Issue 1664001: Fixes possible crash if the window hosting a menu was closed while the (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 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 | « views/controls/menu/menu_item_view.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/submenu_view.h
diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h
index 1e82f73e277756979ab2c6df2113176ba70f5f94..fd2bd027e79066f21ddede76b0b05861ccf41dbe 100644
--- a/views/controls/menu/submenu_view.h
+++ b/views/controls/menu/submenu_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -118,6 +118,11 @@ class SubmenuView : public View {
// Returns the NativeWindow host of the menu, or NULL if not showing.
gfx::NativeWindow native_window() const;
+ // Invoked if the menu is prematurely destroyed. This can happen if the window
+ // closes while the menu is shown. If invoked the SubmenuView must drop all
+ // references to the MenuHost as the MenuHost is about to be deleted.
+ void MenuHostDestroyed();
+
// Padding around the edges of the submenu.
static const int kSubmenuBorderSize;
@@ -138,7 +143,8 @@ class SubmenuView : public View {
// Parent menu item.
MenuItemView* parent_menu_item_;
- // Widget subclass used to show the children.
+ // Widget subclass used to show the children. This is deleted when we invoke
+ // |DestroyMenuHost|, or |MenuHostDestroyed| is invoked back on us.
MenuHost* host_;
// If non-null, indicates a drop is in progress and drop_item is the item
« no previous file with comments | « views/controls/menu/menu_item_view.cc ('k') | views/controls/menu/submenu_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698