bug 721315 - clear the faces' mFamily pointers when a font family is deleted. r=jdaggett
authorJonathan Kew <jfkthame@gmail.com>
Thu, 02 Feb 2012 11:24:22 +0000
changeset 86051 5e56264ba8aee888e094411a4bff91c7a61fb55b
parent 86050 b4508f505db35b1e71372667f058a6c8b0924b06
child 86052 fb8fb19f6161045cb122df98a9114525fd0191a7
push id5637
push userjkew@mozilla.com
push dateThu, 02 Feb 2012 11:24:50 +0000
treeherdermozilla-inbound@5e56264ba8ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs721315
milestone13.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 721315 - clear the faces' mFamily pointers when a font family is deleted. r=jdaggett
gfx/thebes/gfxFont.h
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -507,17 +507,28 @@ public:
         mOtherFamilyNamesInitialized(false),
         mHasOtherFamilyNames(false),
         mFaceNamesInitialized(false),
         mHasStyles(false),
         mIsSimpleFamily(false),
         mIsBadUnderlineFamily(false)
         { }
 
-    virtual ~gfxFontFamily() { }
+    virtual ~gfxFontFamily() {
+        // clear Family pointers in our faces; the font entries might stay
+        // alive due to cached font objects, but they can no longer refer
+        // to their families.
+        PRUint32 i = mAvailableFonts.Length();
+        while (i) {
+             gfxFontEntry *fe = mAvailableFonts[--i];
+             if (fe) {
+                 fe->SetFamily(nsnull);
+             }
+        }
+    }
 
     const nsString& Name() { return mName; }
 
     virtual void LocalizedName(nsAString& aLocalizedName);
     virtual bool HasOtherFamilyNames();
     
     nsTArray<nsRefPtr<gfxFontEntry> >& GetFontList() { return mAvailableFonts; }