Bug 1259817. Always clear RefPtr to refresh driver in nsPresContext::Destroy. r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Sat, 26 Mar 2016 00:35:15 -0500
changeset 290554 880f8af31133bd65dde834e9472a66189335a79e
parent 290553 214a78b9334d7bb05ecc9e26d8ed1190318418b2
child 290555 a1ff072697463083c31594b7281176c2cd7e16b8
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1259817
milestone48.0a1
Bug 1259817. Always clear RefPtr to refresh driver in nsPresContext::Destroy. r=mats nsPresContext::Destroy gets called from the desctructor and the cycle collector unlink phase. In the latter the prescontext may live for a while yet.
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -328,18 +328,20 @@ nsPresContext::Destroy()
                                   "nglayout.debug.paint_flashing",
                                   this);
   Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback,
                                   "nglayout.debug.paint_flashing_chrome",
                                   this);
 
   // Disconnect the refresh driver *after* the transition manager, which
   // needs it.
-  if (mRefreshDriver && mRefreshDriver->PresContext() == this) {
-    mRefreshDriver->Disconnect();
+  if (mRefreshDriver) {
+    if (mRefreshDriver->PresContext() == this) {
+      mRefreshDriver->Disconnect();
+    }
     mRefreshDriver = nullptr;
   }
 }
 
 nsPresContext::~nsPresContext()
 {
   NS_PRECONDITION(!mShell, "Presshell forgot to clear our mShell pointer");
   SetShell(nullptr);