Bug 1392235, part 1 - Fix AutoReferenceChainGuard::Reference to flag the guarded frame as in-use. r=longsonr
authorJonathan Watt <jwatt@jwatt.org>
Tue, 22 Aug 2017 11:43:15 +0100
changeset 429816 beb2e1710ae47fe77e02f2d644aa830751045790
parent 429815 246cba2233e3103ac3e0f160c40ccec9e6946ec9
child 429817 0cbc588a5934f03a9343975e6ab684ba01fda03b
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs1392235
milestone57.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 1392235, part 1 - Fix AutoReferenceChainGuard::Reference to flag the guarded frame as in-use. r=longsonr MozReview-Commit-ID: 2HgAugFnKQ5
layout/svg/AutoReferenceChainGuard.h
--- a/layout/svg/AutoReferenceChainGuard.h
+++ b/layout/svg/AutoReferenceChainGuard.h
@@ -81,17 +81,16 @@ public:
                           int16_t aMaxChainLength = sDefaultMaxChainLength
                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
     : mFrame(aFrame)
     , mFrameInUse(aFrameInUse)
     , mMaxChainLength(aMaxChainLength)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     MOZ_ASSERT(aFrame && aFrameInUse && aChainCounter);
-    MOZ_ASSERT(!(*mFrameInUse), "Undetected reference loop!");
     MOZ_ASSERT(aMaxChainLength > 0);
     MOZ_ASSERT(*aChainCounter == noChain ||
                (*aChainCounter >= 0 && *aChainCounter < aMaxChainLength));
 
     if (*aChainCounter == noChain) {
       // Initialize - we start at aMaxChainLength and decrement towards zero.
       *aChainCounter = aMaxChainLength;
     }
@@ -121,16 +120,18 @@ public:
    * console (only once).
    */
   MOZ_MUST_USE bool Reference() {
     if (MOZ_UNLIKELY(*mFrameInUse)) {
       ReportErrorToConsole();
       return false;
     }
 
+    *mFrameInUse = true;
+
     // If we fail this assertion then either a consumer failed to break a
     // reference loop/chain, or else they called Reference() more than once
     MOZ_ASSERT(*mChainCounter >= 0);
 
     (*mChainCounter)--;
 
     if (MOZ_UNLIKELY(*mChainCounter < 0)) {
       ReportErrorToConsole();