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

Issue 10154013: Fixes crash in closing menus. There are two issues here: (Closed)

Created:
8 years, 8 months ago by sky
Modified:
8 years, 8 months ago
CC:
chromium-reviews, tfarina, ben+watch_chromium.org
Visibility:
Public.

Description

Fixes crash in closing menus. There are two issues here: . How quick we quit the nested message loop. Previously I relied on the Dispatcher to exit the nested message loop. The problem with this is that the Dispatcher is only invoked before native events, so that it's entirely possible for the Widget::CloseNow task to be processed before the Dispatcher as invoked again. I've changed to use MessageLoop::QuitNow which makes it so the MessageLoop won't process any more messages and will pop out of the dispatcher. . Owned windows are only destroyed when the parent itself is destroyed. Because the mouse event to show the menu originates from the parent this means by the time we pop from the nested message loop the parent Widget and Views have been deleted and we crash. I've plumbed through notification that an owned parent is closing (really Hide()ing, but Hide() pretty much means we're going to Close), so that menu can exit the nested message loop before the owned parent is destroyed. This is only necessary on Windows as we handled owned windows slightly differently under aura. BUG=124123 64303 TEST=none R=ben@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=134108

Patch Set 1 #

Patch Set 2 : fixor #

Total comments: 6

Patch Set 3 : OnOwnerClosing and more comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+81 lines, -16 lines) Patch
M chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc View 4 chunks +8 lines, -2 lines 0 comments Download
M chrome/test/base/view_event_test_base.cc View 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/controls/menu/menu_controller.h View 1 chunk +4 lines, -0 lines 0 comments Download
M ui/views/controls/menu/menu_controller.cc View 1 2 5 chunks +20 lines, -13 lines 0 comments Download
M ui/views/controls/menu/menu_host.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/controls/menu/menu_host.cc View 1 2 1 chunk +7 lines, -0 lines 2 comments Download
M ui/views/widget/native_widget_win.h View 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/widget/native_widget_win.cc View 1 2 3 chunks +27 lines, -0 lines 0 comments Download
M ui/views/widget/widget.h View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M ui/views/widget/widget.cc View 1 2 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
sky
8 years, 8 months ago (2012-04-26 00:30:04 UTC) #1
sky
There's some additional cleanup I can do after landing this, but I want to get ...
8 years, 8 months ago (2012-04-26 00:30:28 UTC) #2
Ben Goodger (Google)
lgtm https://chromiumcodereview.appspot.com/10154013/diff/2001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://chromiumcodereview.appspot.com/10154013/diff/2001/ui/views/controls/menu/menu_controller.cc#newcode322 ui/views/controls/menu/menu_controller.cc:322: message_loop_depth_++; can you dcheck that this never exceeds ...
8 years, 8 months ago (2012-04-26 02:34:54 UTC) #3
oshima
https://chromiumcodereview.appspot.com/10154013/diff/2001/ui/views/controls/menu/menu_controller.cc File ui/views/controls/menu/menu_controller.cc (right): https://chromiumcodereview.appspot.com/10154013/diff/2001/ui/views/controls/menu/menu_controller.cc#newcode322 ui/views/controls/menu/menu_controller.cc:322: message_loop_depth_++; On 2012/04/26 02:34:54, Ben Goodger (Google) wrote: > ...
8 years, 8 months ago (2012-04-26 03:05:26 UTC) #4
sky
I've incorporated all the suggestions and uploaded a new patch. http://codereview.chromium.org/10154013/diff/2001/ui/views/widget/native_widget_win.cc File ui/views/widget/native_widget_win.cc (right): http://codereview.chromium.org/10154013/diff/2001/ui/views/widget/native_widget_win.cc#newcode911 ...
8 years, 8 months ago (2012-04-26 03:54:53 UTC) #5
oshima
On Wed, Apr 25, 2012 at 8:54 PM, <sky@chromium.org> wrote: > I've incorporated all the ...
8 years, 8 months ago (2012-04-26 04:41:04 UTC) #6
sky
On 2012/04/26 04:41:04, oshima wrote: > On Wed, Apr 25, 2012 at 8:54 PM, <mailto:sky@chromium.org> ...
8 years, 8 months ago (2012-04-26 14:53:21 UTC) #7
oshima
lgtm http://codereview.chromium.org/10154013/diff/12001/ui/views/controls/menu/menu_host.cc File ui/views/controls/menu/menu_host.cc (right): http://codereview.chromium.org/10154013/diff/12001/ui/views/controls/menu/menu_host.cc#newcode111 ui/views/controls/menu/menu_host.cc:111: void MenuHost::OnOwnerClosing() { can you add comment that ...
8 years, 8 months ago (2012-04-26 15:03:07 UTC) #8
oshima
8 years, 8 months ago (2012-04-26 15:04:44 UTC) #9
On 2012/04/26 15:03:07, oshima wrote:
> lgtm
> 
>
http://codereview.chromium.org/10154013/diff/12001/ui/views/controls/menu/men...
> File ui/views/controls/menu/menu_host.cc (right):
> 
>
http://codereview.chromium.org/10154013/diff/12001/ui/views/controls/menu/men...
> ui/views/controls/menu/menu_host.cc:111: void MenuHost::OnOwnerClosing() {
> can you add comment that this is invoked only on windows?
> 
>
http://codereview.chromium.org/10154013/diff/12001/ui/views/controls/menu/men...
> ui/views/controls/menu/menu_host.cc:112: MenuController* menu_controller =
> can you add comment that this is used only on Windows and why?

oops sorry, rietveld didn't show the old message and I thought it's canceled. :(

Powered by Google App Engine
This is Rietveld 408576698