Skip to content

Commit 6a7a562

Browse files
committed
Fix CEF rendering
1 parent 0fbaef3 commit 6a7a562

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Client/cefweb/CWebApp.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,7 @@ namespace
4545
// Prevent Chromium from dropping privileges; required for elevated launches (see chromium/3960)
4646
commandLine->AppendSwitch("do-not-de-elevate");
4747

48-
if (!g_pCore || !IsReadablePointer(g_pCore, sizeof(void*))) [[unlikely]]
49-
return;
50-
51-
const auto webCore = static_cast<CWebCore*>(g_pCore->GetWebCore());
52-
if (!webCore || !IsReadablePointer(webCore, sizeof(void*)))
53-
return;
54-
55-
// Honour the GPU toggle exposed through settings and hard-disable compositor for stability
56-
if (!webCore->GetGPUEnabled())
57-
{
58-
commandLine->AppendSwitch("disable-gpu");
59-
}
60-
48+
// Must apply essential CEF switches regardless of WebCore availability
6149
commandLine->AppendSwitch("disable-gpu-compositing");
6250
commandLine->AppendSwitch("enable-begin-frame-scheduling");
6351
// Explicitly block account sign-in to avoid crashes when Google API keys are registered on the system
@@ -69,6 +57,20 @@ namespace
6957
commandLine->AppendSwitchWithValue("autoplay-policy", "no-user-gesture-required");
7058
commandLine->AppendSwitchWithValue("enable-blink-features", "ShadowDOMV0,CustomElementsV0,HTMLImports");
7159
}
60+
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())
71+
{
72+
commandLine->AppendSwitch("disable-gpu");
73+
}
7274
}
7375
} // namespace
7476

0 commit comments

Comments
 (0)