Bug 1323777 part 2 - make PresShell::Destroy() return immediately if it's already been called. r=smaug
authorMats Palmgren <mats@mozilla.com>
Wed, 25 Jan 2017 23:34:03 +0200
changeset 331039 65fb78694c3a51dafac29cb886cfc2bdb8b4a301
parent 331038 581720c25bf0f91392e45d106a4baf96e88575f9
child 331040 021414da3a4c813770106d915107686ac2d5310b
push id86155
push useropettay@mozilla.com
push dateWed, 25 Jan 2017 22:05:48 +0000
treeherdermozilla-inbound@021414da3a4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1323777
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1323777 part 2 - make PresShell::Destroy() return immediately if it's already been called. r=smaug
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1147,16 +1147,21 @@ LogTextPerfStats(gfxTextPerfMetrics* aTe
             aCounts.genericLookups,
             aTextPerf->cumulative.textrunDestr));
   }
 }
 
 void
 PresShell::Destroy()
 {
+  // Do not add code before this line please!
+  if (mHaveShutDown) {
+    return;
+  }
+
   NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
     "destroy called on presshell while scripts not blocked");
 
   // dump out cumulative text perf metrics
   gfxTextPerfMetrics* tp;
   if (mPresContext && (tp = mPresContext->GetTextPerfMetrics())) {
     tp->Accumulate();
     if (tp->cumulative.numChars > 0) {
@@ -1181,19 +1186,16 @@ PresShell::Destroy()
 #ifdef MOZ_REFLOW_PERF
   DumpReflows();
   if (mReflowCountMgr) {
     delete mReflowCountMgr;
     mReflowCountMgr = nullptr;
   }
 #endif
 
-  if (mHaveShutDown)
-    return;
-
   if (mZoomConstraintsClient) {
     mZoomConstraintsClient->Destroy();
     mZoomConstraintsClient = nullptr;
   }
   if (mMobileViewportManager) {
     mMobileViewportManager->Destroy();
     mMobileViewportManager = nullptr;
   }