| Index: components/mus/public/cpp/lib/window.cc
|
| diff --git a/components/mus/public/cpp/lib/window.cc b/components/mus/public/cpp/lib/window.cc
|
| index bbbcc47dc4cc00bcb441157ddfdfa0352179f0ad..9d6157fd17db67d698ecb881ac25b10a564322e3 100644
|
| --- a/components/mus/public/cpp/lib/window.cc
|
| +++ b/components/mus/public/cpp/lib/window.cc
|
| @@ -147,8 +147,7 @@ class ScopedSetBoundsNotifier {
|
| // Some operations are only permitted in the connection that created the window.
|
| bool OwnsWindow(WindowTreeConnection* connection, Window* window) {
|
| return !connection ||
|
| - static_cast<WindowTreeClientImpl*>(connection)
|
| - ->OwnsWindow(window->id());
|
| + static_cast<WindowTreeClientImpl*>(connection)->OwnsWindow(window);
|
| }
|
|
|
| bool IsConnectionRoot(Window* window) {
|
| @@ -274,6 +273,9 @@ void Window::AddChild(Window* child) {
|
| // embeddee in an embedder-embeddee relationship.
|
| if (connection_)
|
| CHECK_EQ(child->connection(), connection_);
|
| + // Roots can not be added as children of other windows.
|
| + if (tree_client() && tree_client()->IsRoot(child))
|
| + return;
|
| LocalAddChild(child);
|
| if (connection_)
|
| tree_client()->AddChild(this, child->id());
|
|
|