Bug 1446553 - Init gfxPlatform before checking if WebRender will be used r=karlt draft
authorJames Willcox <snorp@snorp.net>
Thu, 29 Mar 2018 08:44:09 -0500
changeset 774742 8e86c9eb8410eb69ebc34063f96ba6535bfd5ae3
parent 771183 3c7e0c97f59a42d74bb3a3c192aea4c037e3092d
push id104487
push userbmo:snorp@snorp.net
push dateThu, 29 Mar 2018 13:47:24 +0000
reviewerskarlt
bugs1446553
milestone61.0a1
Bug 1446553 - Init gfxPlatform before checking if WebRender will be used r=karlt This avoids a crash due to use of uninitialized gfxVars. MozReview-Commit-ID: EaAxB8hbT2E
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3636,18 +3636,21 @@ nsWindow::Create(nsIWidget* aParent,
         bool useAlphaVisual = (mWindowType == eWindowType_popup &&
                                aInitData->mSupportTranslucency);
 
         // mozilla.widget.use-argb-visuals is a hidden pref defaulting to false
         // to allow experimentation
         if (Preferences::GetBool("mozilla.widget.use-argb-visuals", false))
             useAlphaVisual = true;
 
-        bool useWebRender = gfxPlatform::Initialized() &&
-            gfx::gfxVars::UseWebRender() &&
+        // Ensure gfxPlatform is initialized, since that is what initializes
+        // gfxVars, used below.
+        Unused << gfxPlatform::GetPlatform();
+
+        bool useWebRender = gfx::gfxVars::UseWebRender() &&
             AllowWebRenderForThisWindow();
 
         // If using WebRender on X11, we need to select a visual with a depth buffer,
         // as well as an alpha channel if transparency is requested. This must be done
         // before the widget is realized.
         if (mIsX11Display && useWebRender) {
             auto display =
                 GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(mShell));