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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 279073002: views: Terminate the nested message-loop correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index f5d28ef1d79a610f3834115b463b4b74d7566fc0..6eb8e35f860aeb4c299637eb674148df9dbde5eb 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -2378,17 +2378,19 @@ void MenuController::SetExitType(ExitType type) {
// the current loop.
bool quit_now = ShouldQuitNow() && exit_type_ != EXIT_NONE &&
message_loop_depth_;
+ if (quit_now)
+ TerminateNestedMessageLoop();
+}
- if (quit_now) {
- if (owner_) {
- aura::Window* root = owner_->GetNativeWindow()->GetRootWindow();
- aura::client::GetDispatcherClient(root)->QuitNestedMessageLoop();
- } else {
- base::MessageLoop::current()->QuitNow();
- }
- // Restore the previous dispatcher.
- nested_dispatcher_.reset();
+void MenuController::TerminateNestedMessageLoop() {
+ if (owner_) {
+ aura::Window* root = owner_->GetNativeWindow()->GetRootWindow();
+ aura::client::GetDispatcherClient(root)->QuitNestedMessageLoop();
+ } else {
+ base::MessageLoop::current()->QuitNow();
}
+ // Restore the previous dispatcher.
+ nested_dispatcher_.reset();
}
bool MenuController::ShouldQuitNow() const {
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698