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 374544 f3ee1078d7099276195aed0603e12d26dfae1807
parent 374543 c92dc508b3b50cbf159b6470254d7b4291daf111
child 374545 bfc13d436dd486b917fb707f9648651efe5d35fb
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1343069
milestone54.0a1
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;
     }
   }