Index: components/surfaces/display_impl.cc |
diff --git a/components/surfaces/display_impl.cc b/components/surfaces/display_impl.cc |
index 6306438632189eb5ce24c13ccd9a5d5975f791a5..3ffd38922e0bf1b629a82af2cbb952df1e4c4b33 100644 |
--- a/components/surfaces/display_impl.cc |
+++ b/components/surfaces/display_impl.cc |
@@ -59,6 +59,9 @@ DisplayImpl::~DisplayImpl() { |
if (display_) { |
factory_.Destroy(cc_id_); |
scheduler_->RemoveDisplay(display_.get()); |
+ // By deleting the object after display_ is reset, OutputSurfaceLost can |
+ // know not to do anything (which would result in double delete). |
+ delete display_.release(); |
} |
} |
@@ -96,6 +99,9 @@ void DisplayImpl::CommitVSyncParameters(base::TimeTicks timebase, |
} |
void DisplayImpl::OutputSurfaceLost() { |
+ if (!display_) // Shutdown case |
+ return; |
+ |
// If our OutputSurface is lost we can't draw until we get a new one. For now, |
// destroy the display and create a new one when our ContextProvider provides |
// a new one. |