Bug 1343069 - Capture a strong reference to nsRootPresContext in EnsureEventualDidPaintEvent, r=mattwoodrow
authorMichael Layzell <michael@thelayzells.com>
Tue, 28 Feb 2017 13:37:58 -0500
changeset 392159 f3ee1078d7099276195aed0603e12d26dfae1807
parent 392158 c92dc508b3b50cbf159b6470254d7b4291daf111
child 392160 bfc13d436dd486b917fb707f9648651efe5d35fb
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1343069
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 1343069 - Capture a strong reference to nsRootPresContext in EnsureEventualDidPaintEvent, r=mattwoodrow MozReview-Commit-ID: GRi4afSovP4
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -3263,19 +3263,20 @@ nsRootPresContext::EnsureEventualDidPain
   for (NotifyDidPaintTimer& t : mNotifyDidPaintTimers) {
     if (t.mTransactionId == aTransactionId) {
       return;
     }
   }
 
   nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
   if (timer) {
-    nsresult rv = timer->InitWithCallback(NewTimerCallback([=](){
+    RefPtr<nsRootPresContext> self = this;
+    nsresult rv = timer->InitWithCallback(NewTimerCallback([self, aTransactionId](){
       nsAutoScriptBlocker blockScripts;
-      this->NotifyDidPaintForSubtree(aTransactionId);
+      self->NotifyDidPaintForSubtree(aTransactionId);
     }), 100, nsITimer::TYPE_ONE_SHOT);
 
     if (NS_SUCCEEDED(rv)) {
       NotifyDidPaintTimer* t = mNotifyDidPaintTimers.AppendElement();
       t->mTransactionId = aTransactionId;
       t->mTimer = timer;
     }
   }