Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: components/surfaces/display_impl.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash in surfaces if surfaceimpl outlives the app, and a double delete in browser Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698