Index: components/mus/ws/connection_manager.cc |
diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc |
index b7c22f994242c1619aad9cd86495c3f19e828cf0..4f96647607f20237f1f76f67f6d44aa717775d04 100644 |
--- a/components/mus/ws/connection_manager.cc |
+++ b/components/mus/ws/connection_manager.cc |
@@ -539,7 +539,11 @@ ServerWindow* ConnectionManager::FindWindowForSurface( |
const ServerWindow* ancestor, |
mojom::SurfaceType surface_type, |
const ClientWindowId& client_window_id) { |
- WindowTreeImpl* window_tree = GetConnection(ancestor->id().connection_id); |
+ WindowTreeImpl* window_tree; |
+ if (ancestor->id().connection_id == kInvalidConnectionId) |
+ window_tree = GetWindowTreeHostByWindow(ancestor)->GetWindowTree(); |
+ else |
+ window_tree = GetConnection(ancestor->id().connection_id); |
if (!window_tree) |
return nullptr; |
if (surface_type == mojom::SurfaceType::DEFAULT) { |