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

Side by Side Diff: ui/views/controls/menu/menu_host.cc

Issue 10178031: Fixes possible crash in closing menus. Specifically if we Close a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/menu_host.h" 5 #include "ui/views/controls/menu/menu_host.h"
6 6
7 #include "ui/views/controls/menu/menu_controller.h" 7 #include "ui/views/controls/menu/menu_controller.h"
8 #include "ui/views/controls/menu/menu_host_root_view.h" 8 #include "ui/views/controls/menu/menu_host_root_view.h"
9 #include "ui/views/controls/menu/menu_item_view.h" 9 #include "ui/views/controls/menu/menu_item_view.h"
10 #include "ui/views/controls/menu/native_menu_host.h" 10 #include "ui/views/controls/menu/native_menu_host.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!destroying_) { 102 if (!destroying_) {
103 // We weren't explicitly told to destroy ourselves, which means the menu was 103 // We weren't explicitly told to destroy ourselves, which means the menu was
104 // deleted out from under us (the window we're parented to was closed). Tell 104 // deleted out from under us (the window we're parented to was closed). Tell
105 // the SubmenuView to drop references to us. 105 // the SubmenuView to drop references to us.
106 submenu_->MenuHostDestroyed(); 106 submenu_->MenuHostDestroyed();
107 } 107 }
108 Widget::OnNativeWidgetDestroyed(); 108 Widget::OnNativeWidgetDestroyed();
109 } 109 }
110 110
111 void MenuHost::OnOwnerClosing() { 111 void MenuHost::OnOwnerClosing() {
112 if (destroying_)
113 return;
114
112 MenuController* menu_controller = 115 MenuController* menu_controller =
113 submenu_->GetMenuItem()->GetMenuController(); 116 submenu_->GetMenuItem()->GetMenuController();
114 if (menu_controller && !menu_controller->drag_in_progress()) 117 if (menu_controller && !menu_controller->drag_in_progress())
115 menu_controller->CancelAll(); 118 menu_controller->CancelAll();
116 } 119 }
117 120
118 } // namespace views 121 } // namespace views
OLDNEW
« 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