Bug 975460 - disable async font loader on OSX 10.6 (beta/aurora). r=smichaud,mkato a=sylvestre
authorJohn Daggett <jdaggett@mozilla.com>
Mon, 07 Apr 2014 16:58:50 +0900
changeset 183642 79c61c6f632d
parent 183641 f7faeaf19dfa
child 183643 13bf6fe8df1f
push id3432
push userjdaggett@mozilla.com
push date2014-04-07 08:00 +0000
Treeherderresults
reviewerssmichaud, mkato, sylvestre
bugs975460
milestone29.0
Bug 975460 - disable async font loader on OSX 10.6 (beta/aurora). r=smichaud,mkato a=sylvestre
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxMacPlatformFontList.mm
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -35,16 +35,20 @@
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
 #include "gfxSVGGlyphs.h"
 #include "gfx2DGlue.h"
 
+#if defined(XP_MACOSX)
+#include "nsCocoaFeatures.h"
+#endif
+
 #include "cairo.h"
 #include "gfxFontTest.h"
 
 #include "harfbuzz/hb.h"
 #include "harfbuzz/hb-ot.h"
 #include "graphite2/Font.h"
 
 #include "nsCRT.h"
@@ -1286,19 +1290,29 @@ gfxFontFamily::ReadFaceNames(gfxPlatform
                              bool aNeedFullnamePostscriptNames,
                              FontInfoData *aFontInfoData)
 {
     // if all needed names have already been read, skip
     if (mOtherFamilyNamesInitialized &&
         (mFaceNamesInitialized || !aNeedFullnamePostscriptNames))
         return;
 
+    bool asyncFontLoaderDisabled = false;
+
+#if defined(XP_MACOSX)
+    // bug 975460 - async font loader crashes sometimes under 10.6, disable
+    if (!nsCocoaFeatures::OnLionOrLater()) {
+        asyncFontLoaderDisabled = true;
+    }
+#endif
+
     if (!mOtherFamilyNamesInitialized &&
         aFontInfoData &&
-        aFontInfoData->mLoadOtherNames)
+        aFontInfoData->mLoadOtherNames &&
+        !asyncFontLoaderDisabled)
     {
         nsAutoTArray<nsString,4> otherFamilyNames;
         bool foundOtherNames =
             aFontInfoData->GetOtherFamilyNames(mName, otherFamilyNames);
         if (foundOtherNames) {
             uint32_t i, n = otherFamilyNames.Length();
             for (i = 0; i < n; i++) {
                 aPlatformFontList->AddOtherFamilyName(this, otherFamilyNames[i]);
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -56,16 +56,17 @@
 
 #include "nsServiceManagerUtils.h"
 #include "nsTArray.h"
 
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsISimpleEnumerator.h"
 #include "nsCharTraits.h"
+#include "nsCocoaFeatures.h"
 #include "gfxFontConstants.h"
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/gfx/2D.h"
 
 #include <unistd.h>
@@ -583,17 +584,19 @@ gfxMacFontFamily::FindStyleVariations(Fo
 /* gfxSingleFaceMacFontFamily */
 #pragma mark-
 
 class gfxSingleFaceMacFontFamily : public gfxFontFamily
 {
 public:
     gfxSingleFaceMacFontFamily(nsAString& aName) :
         gfxFontFamily(aName)
-    {}
+    {
+        mFaceNamesInitialized = true; // omit from face name lists
+    }
 
     virtual ~gfxSingleFaceMacFontFamily() {}
 
     virtual void LocalizedName(nsAString& aLocalizedName);
 
     virtual void ReadOtherFamilyNames(gfxPlatformFontList *aPlatformFontList);
 };
 
@@ -1031,17 +1034,20 @@ public:
                 bool aLoadCmaps) :
         FontInfoData(aLoadOtherNames, aLoadFaceNames, aLoadCmaps)
     {}
 
     virtual ~MacFontInfo() {}
 
     virtual void Load() {
         nsAutoreleasePool localPool;
-        FontInfoData::Load();
+        // bug 975460 - async font loader crashes sometimes under 10.6, disable
+        if (nsCocoaFeatures::OnLionOrLater()) {
+            FontInfoData::Load();
+        }
     }
 
     // loads font data for all members of a given family
     virtual void LoadFontFamilyData(const nsAString& aFamilyName);
 };
 
 void
 MacFontInfo::LoadFontFamilyData(const nsAString& aFamilyName)