Bug 1485358 - fix purging of missing glyph WebRender users. r=me
authorLee Salzman <lsalzman@mozilla.com>
Wed, 22 Aug 2018 11:12:33 -0400
changeset 432830 4621d2fd3f17
parent 432829 349025ae0ac8
child 432831 257fe22ca35f
push id106889
push userlsalzman@mozilla.com
push dateWed, 22 Aug 2018 15:12:55 +0000
treeherdermozilla-inbound@4621d2fd3f17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1485358
milestone63.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 1485358 - fix purging of missing glyph WebRender users. r=me
gfx/thebes/gfxFontMissingGlyphs.cpp
--- a/gfx/thebes/gfxFontMissingGlyphs.cpp
+++ b/gfx/thebes/gfxFontMissingGlyphs.cpp
@@ -152,17 +152,16 @@ public:
         if (!aManager->HasUserData(&sWRUserDataKey)) {
             aManager->SetUserData(&sWRUserDataKey, new WRUserData(aManager));
         }
     }
 
     void
     Remove()
     {
-        remove();
         mManager->RemoveUserData(&sWRUserDataKey);
     }
 
     layers::WebRenderLayerManager* mManager;
 
     static UserDataKey sWRUserDataKey;
 };
 
@@ -227,18 +226,21 @@ PurgeWRGlyphAtlas()
                     (uint32_t)(uintptr_t)gWRGlyphAtlas[i]->GetUserData(
                         reinterpret_cast<UserDataKey*>(manager));
                 if (handle) {
                     manager->AddImageKeyForDiscard(
                         wr::ImageKey{manager->WrBridge()->GetNamespace(), handle});
                 }
             }
         }
-        // Remove the layer manager's destroy notification.
-        user->Remove();
+    }
+    // Remove the layer managers' destroy notifications only after processing
+    // so as not to mess up gWRUsers iteration.
+    while (!gWRUsers.isEmpty()) {
+        gWRUsers.popFirst()->Remove();
     }
     // Finally, clear out the atlases.
     for (size_t i = 0; i < 8; i++) {
         gWRGlyphAtlas[i] = nullptr;
     }
 }
 
 WRUserData::WRUserData(layers::WebRenderLayerManager* aManager)