bug 633500 - fix invisible text by not using proxyFontEntry that has been destroyed when all sources fail. r=jrmuizel a=blocking
authorJonathan Kew <jfkthame@gmail.com>
Fri, 11 Feb 2011 21:19:23 +0000
changeset 62416 ad2df327c3c37c1419fffe4a2faa353188e41dad
parent 62415 b59521d4350dbe52544fde1b9a8dd127a3548f78
child 62417 36c9d7639a7c98283ec7d7bdc6642735cad5cd56
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, blocking
bugs633500
milestone2.0b12pre
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 633500 - fix invisible text by not using proxyFontEntry that has been destroyed when all sources fail. r=jrmuizel a=blocking
gfx/thebes/gfxUserFontSet.cpp
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -188,27 +188,32 @@ gfxUserFontSet::FindFontEntry(const nsAS
         aWaitForUserFont =
             (proxyEntry->mLoadingState < gfxProxyFontEntry::LOADING_SLOWLY);
         return nsnull;
     }
 
     // hasn't been loaded yet, start the load process
     LoadStatus status;
 
+    // NOTE that if all sources in the entry fail, this will delete proxyEntry,
+    // so we cannot use it again if status==STATUS_END_OF_LIST
     status = LoadNext(proxyEntry);
 
     // if the load succeeded immediately, the font entry was replaced so
     // search again
     if (status == STATUS_LOADED) {
         return family->FindFontForStyle(aFontStyle, aNeedsBold);
     }
 
+    // check whether we should wait for load to complete before painting
+    // a fallback font -- but not if all sources failed (bug 633500)
+    aWaitForUserFont = (status != STATUS_END_OF_LIST) &&
+        (proxyEntry->mLoadingState < gfxProxyFontEntry::LOADING_SLOWLY);
+
     // if either loading or an error occurred, return null
-    aWaitForUserFont =
-        (proxyEntry->mLoadingState < gfxProxyFontEntry::LOADING_SLOWLY);
     return nsnull;
 }
 
 // Given a buffer of downloaded font data, do any necessary preparation
 // to make it into usable OpenType.
 // May return the original pointer unchanged, or a newly-allocated
 // block (in which case the passed-in block is NS_Free'd).
 // aLength is updated if necessary to the new length of the data.