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

Unified Diff: ash/wm/toplevel_window_event_handler.cc

Issue 2540143004: Prevent a crash if the window was deleted while in a drag runloop (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/toplevel_window_event_handler.cc
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc
index 067e23875a9b8f5da41b43e5c55c461bbf28c4ca..cfc8ebffc70ae4d1cfa6270e9281e755188411f0 100644
--- a/ash/wm/toplevel_window_event_handler.cc
+++ b/ash/wm/toplevel_window_event_handler.cc
@@ -14,6 +14,7 @@
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
+#include "ui/aura/window_tracker.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
@@ -94,13 +95,16 @@ aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop(
wm::WindowState* window_state = wm::GetWindowState(source);
const bool window_position_managed = window_state->window_position_managed();
window_state->set_window_position_managed(false);
+ aura::WindowTracker tracker({source});
run_loop.Run();
if (!weak_ptr)
return aura::client::MOVE_CANCELED;
- window_state->set_window_position_managed(window_position_managed);
+ // Make sure the window hasn't been deleted.
+ if (tracker.Contains(source))
+ window_state->set_window_position_managed(window_position_managed);
in_move_loop_ = false;
return result == wm::WmToplevelWindowEventHandler::DragResult::SUCCESS
« 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