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
--- 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));