Index: components/mus/mus_app.cc |
diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc |
index 9f226a9f8d99c6d5bab5380c98f1c6e4a66ac995..8128d020a583e233917c31c7935c55129cddfefc 100644 |
--- a/components/mus/mus_app.cc |
+++ b/components/mus/mus_app.cc |
@@ -69,10 +69,13 @@ struct MandolineUIServicesApp::UserState { |
MandolineUIServicesApp::MandolineUIServicesApp() {} |
MandolineUIServicesApp::~MandolineUIServicesApp() { |
- if (platform_display_init_params_.gpu_state) |
- platform_display_init_params_.gpu_state->StopThreads(); |
// Destroy |window_server_| first, since it depends on |event_source_|. |
+ // WindowServer (or more correctly its Displays) may have state that needs to |
+ // be destroyed before GpuState as well. |
window_server_.reset(); |
+ |
+ if (platform_display_init_params_.gpu_state) |
+ platform_display_init_params_.gpu_state->StopThreads(); |
} |
void MandolineUIServicesApp::InitializeResources(mojo::Connector* connector) { |
@@ -181,7 +184,9 @@ void MandolineUIServicesApp::OnFirstDisplayReady() { |
} |
void MandolineUIServicesApp::OnNoMoreDisplays() { |
- base::MessageLoop::current()->QuitWhenIdle(); |
+ // We may get here from the destructor, in which case there is no messageloop. |
+ if (base::MessageLoop::current()) |
+ base::MessageLoop::current()->QuitWhenIdle(); |
} |
scoped_ptr<ws::WindowTreeBinding> |