Bug 1357307 - Make sure gfxPrefs instance is created before accessing it. r=milan
☠☠ backed out by 6efe7915f97b ☠ ☠
authorvincentliu <vliu@mozilla.com>
Mon, 24 Apr 2017 14:10:17 +0800
changeset 567071 9f2fe5e3f78c8174fab116ebc9091d0e357fb121
parent 567070 7457db3be2751899c296052079dc5e6ebecc284d
child 567072 89407b3607a2feedd46b2d13717724bc5f41b33b
push id55429
push userbmo:hskupin@gmail.com
push dateMon, 24 Apr 2017 10:48:57 +0000
reviewersmilan
bugs1357307
milestone55.0a1
Bug 1357307 - Make sure gfxPrefs instance is created before accessing it. r=milan
widget/nsXPLookAndFeel.cpp
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -14,16 +14,17 @@
 #include "nsFont.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/widget/WidgetMessageUtils.h"
 
 #include "gfxPlatform.h"
+#include "gfxPrefs.h"
 #include "qcms.h"
 
 #ifdef DEBUG
 #include "nsSize.h"
 #endif
 
 using namespace mozilla;
 
@@ -815,16 +816,18 @@ nsXPLookAndFeel::GetColorImpl(ColorID aI
   }
 
   if (sUseNativeColors && aUseStandinsForNativeColors) {
     aResult = GetStandinForNativeColor(aID);
     return NS_OK;
   }
 
   if (sUseNativeColors && NS_SUCCEEDED(NativeGetColor(aID, aResult))) {
+    MOZ_ASSERT(NS_IsMainThread());
+    gfxPrefs::GetSingleton();
     if ((gfxPlatform::GetCMSMode() == eCMSMode_All) &&
          !IsSpecialColor(aID, aResult)) {
       qcms_transform *transform = gfxPlatform::GetCMSInverseRGBTransform();
       if (transform) {
         uint8_t color[3];
         color[0] = NS_GET_R(aResult);
         color[1] = NS_GET_G(aResult);
         color[2] = NS_GET_B(aResult);