views: menu: Enforce nested dispatcher destruction ordering
commit4c7aa2ed5aeb5550c9b8f60643c6649ab5052435
authorspang <spang@chromium.org>
Fri, 9 Jan 2015 01:26:25 +0000 (8 17:26 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 9 Jan 2015 01:27:53 +0000 (9 01:27 +0000)
treebc904b408314ecc51ce448897098afd1cee0d851
parent9008769924ac7544e3fc2467a27c0acb40214cec
views: menu: Enforce nested dispatcher destruction ordering

Nested dispatchers must be destroyed in the opposite order they are
installed. We shouldn't restore the dispatcher in QuitNow() if the nested
loop is still running, since another dispatcher might be stacked on top
of it (e.g. drag & drop).

This fixes a regression since r310020 ("views: menu: Remove
MenuMessageLoop::ShouldQuitNow"). Before that change, we explicitly
checked for drag & drop operations, and delayed message loop termination
if one was in progress. Since it now terminates regardless of DnD state,
the dispatcher gets destroyed earlier and (incorrectly) before the DnD
dispatcher is destroyed. Fix this by delaying dispatcher destruction
until our MenuMessageLoop actually returns.

BUG=447098
TEST=interactive_ui_tests

Review URL: https://codereview.chromium.org/809313010

Cr-Commit-Position: refs/heads/master@{#310651}
chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
ui/views/controls/menu/menu_message_loop_aura.cc
ui/views/controls/menu/menu_message_loop_aura.h