diff --git a/gfx/config/gfxVars.h b/gfx/config/gfxVars.h index d00f0443f02b..808dd838da94 100644 --- a/gfx/config/gfxVars.h +++ b/gfx/config/gfxVars.h @@ -157,6 +157,12 @@ class gfxVars final { size_t mIndex; }; + // Whether the gfxVars singleton instance has been initialized. Most gfx code + // doesn't need to check this, but code that can potentially run before + // gfxPlatform initialization can use this to check whether gfxVars are + // available yet. + static bool IsInitialized() { return sInstance != nullptr; } + private: static StaticAutoPtr sInstance; static StaticAutoPtr> sVarList; diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index ed1033d8fbb7..72d14ca10fac 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -135,6 +135,10 @@ bool gfxDWriteFont::InitDWriteSupport() { void gfxDWriteFont::UpdateSystemTextVars() { MOZ_ASSERT(XRE_IsParentProcess()); + if (!gfxVars::IsInitialized()) { + return; + } + BYTE newQuality = GetSystemTextQuality(); if (gfxVars::SystemTextQuality() != newQuality) { gfxVars::SetSystemTextQuality(newQuality);