Index: ui/aura/mus/window_tree_client.cc |
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc |
index 08e7b028bf1b90a4a7f6d21a9458623df8459d90..0f7351c738917443789d004d657cba9e57e89b8b 100644 |
--- a/ui/aura/mus/window_tree_client.cc |
+++ b/ui/aura/mus/window_tree_client.cc |
@@ -189,6 +189,7 @@ WindowTreeClient::WindowTreeClient( |
gpu_ = ui::Gpu::Create(connector, std::move(io_task_runner)); |
compositor_context_factory_ = |
base::MakeUnique<MusContextFactory>(gpu_.get()); |
+ initial_context_factory_ = Env::GetInstance()->context_factory(); |
Env::GetInstance()->set_context_factory(compositor_context_factory_.get()); |
} |
} |
@@ -205,6 +206,12 @@ WindowTreeClient::~WindowTreeClient() { |
capture_synchronizer_.reset(); |
client::GetTransientWindowClient()->RemoveObserver(this); |
+ |
+ Env* env = Env::GetInstance(); |
+ if (compositor_context_factory_ && |
+ env->context_factory() == compositor_context_factory_.get()) { |
+ env->set_context_factory(initial_context_factory_); |
+ } |
} |
void WindowTreeClient::ConnectViaWindowTreeFactory() { |