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 490622 4621d2fd3f175f6d7441874ba2645a47aa26c86c
parent 490621 349025ae0ac87f864a13d095b77c63c3adb2aded
child 490623 257fe22ca35fb323125b6a7058d8bda98d08dfcb
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [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)