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 |