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

Unified Diff: ui/wm/core/transient_window_manager.cc

Issue 1464433002: Check that child window was not destroyed inside UpdateTransientChildVisibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment Created 5 years, 1 month 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 | ui/wm/core/transient_window_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/transient_window_manager.cc
diff --git a/ui/wm/core/transient_window_manager.cc b/ui/wm/core/transient_window_manager.cc
index 2ca145d2420dbdd9f9a2fc81fd785e8e64d7a495..f9d723fb0af05f4b1281eef11532ce655e0f5d9c 100644
--- a/ui/wm/core/transient_window_manager.cc
+++ b/ui/wm/core/transient_window_manager.cc
@@ -11,6 +11,7 @@
#include "base/stl_util.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
+#include "ui/aura/window_tracker.h"
#include "ui/wm/core/transient_window_observer.h"
#include "ui/wm/core/transient_window_stacking_client.h"
#include "ui/wm/core/window_util.h"
@@ -162,8 +163,17 @@ void TransientWindowManager::OnWindowVisibilityChanged(Window* window,
// If the window has transient children, updates the transient children's
// visiblity as well.
+ // WindowTracker is used because child window
+ // could be deleted inside UpdateTransientChildVisibility call.
+ aura::WindowTracker tracker;
for (Window* child : transient_children_)
- Get(child)->UpdateTransientChildVisibility(visible);
+ tracker.Add(child);
+
+ while (!tracker.windows().empty()) {
+ Window* window = *(tracker.windows().begin());
+ Get(window)->UpdateTransientChildVisibility(visible);
+ tracker.Remove(window);
+ }
// Remember the show request in |show_on_parent_visible_| and hide it again
// if the following conditions are met
« no previous file with comments | « no previous file | ui/wm/core/transient_window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698