Fix surface crash.
When the surface app is asked to destroy the surface associated with the
current display, it didn't notify the display, which will crash if the
display schedules a draw before being reassociated with a surface. This
fixes this by resetting the display that it isn't associated with a
surface anymore.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/920063002
diff --git a/services/surfaces/surfaces_impl.cc b/services/surfaces/surfaces_impl.cc
index 1119985..8a0ed59 100644
--- a/services/surfaces/surfaces_impl.cc
+++ b/services/surfaces/surfaces_impl.cc
@@ -70,6 +70,11 @@
void SurfacesImpl::DestroySurface(uint32_t local_id) {
factory_.Destroy(QualifyIdentifier(local_id));
+ if (local_id == displayed_surface_) {
+ displayed_surface_ = 0;
+ client_->OnDisplayBeingDestroyed(display_.get());
+ display_.reset();
+ }
}
void SurfacesImpl::CreateGLES2BoundSurface(
@@ -86,6 +91,7 @@
display_->Initialize(make_scoped_ptr(new mojo::DirectOutputSurface(
new mojo::ContextProviderMojo(command_buffer_handle_.Pass()))));
}
+ displayed_surface_ = local_id;
cc::SurfaceId cc_id = QualifyIdentifier(local_id);
factory_.Create(cc_id);
display_->SetSurfaceId(cc_id, 1.f);
@@ -136,6 +142,7 @@
factory_(manager, this),
id_namespace_(id_namespace),
client_(client),
+ displayed_surface_(0),
binding_(this) {
}