Skip to content

Commit 0c91451

Browse files
committed
Fix another CEF bug
1 parent 0807dfb commit 0c91451

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Client/cefweb/CWebApp.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,20 @@ namespace
5858
commandLine->AppendSwitchWithValue("enable-blink-features", "ShadowDOMV0,CustomElementsV0,HTMLImports");
5959
}
6060

61-
// WebCore-dependent settings (can fail safely if WebCore not initialized)
62-
if (!g_pCore || !IsReadablePointer(g_pCore, sizeof(void*))) [[unlikely]]
63-
return;
64-
65-
const auto webCore = static_cast<CWebCore*>(g_pCore->GetWebCore());
66-
if (!webCore || !IsReadablePointer(webCore, sizeof(void*)))
67-
return;
68-
69-
// Honour the GPU toggle exposed through settings
70-
if (!webCore->GetGPUEnabled())
61+
bool disableGpu = false;
62+
if (g_pCore && IsReadablePointer(g_pCore, sizeof(void*)))
7163
{
72-
commandLine->AppendSwitch("disable-gpu");
64+
auto* cvars = g_pCore->GetCVars();
65+
if (cvars && IsReadablePointer(cvars, sizeof(void*)))
66+
{
67+
bool gpuEnabled = true;
68+
cvars->Get("browser_enable_gpu", gpuEnabled);
69+
disableGpu = !gpuEnabled;
70+
}
7371
}
72+
73+
if (disableGpu)
74+
commandLine->AppendSwitch("disable-gpu");
7475
}
7576
} // namespace
7677

0 commit comments

Comments
 (0)