#53314: fix: initialize the system FontConfig before GTK starts on Linux
Merged
Created: Aug 30, 2026, 2:49:19 AM
Merged: Aug 31, 2026, 12:47:11 PM
4 comments
Target: main
Description of Change
Fixes #53200
- Pango 1.52+ spawns a
[pango] fontconfigthread that callsFcInit()as soon as GTK creates its font map, and that races the main thread's own first fontconfig call during toolkit initialization. Both parse the configuration at once and corrupt fontconfig's global state; it later surfaces as a PartitionAlloc freelist check (SIGTRAP, #53200) or a NULL dereference inside expat (microsoft/vscode#322185). Upstream: pango#784, pango#872. - Initialize the system fontconfig once on a helper thread that runs while the Node.js environment is created and is joined before any app code runs, so both later
FcInit()calls return immediately. Nothing else touches fontconfig or callssetenvduring that window. Resolved viadlsymbecause the binary also contains Chromium's bundled fontconfig with hidden visibility, which is a separate copy with separate state (that is also whygfx::GetGlobalFontConfig()ingtk_ui.ccdoes not prevent this). - If the app's main script changed
FONTCONFIG_FILE,FONTCONFIG_PATHorFONTCONFIG_SYSROOT, reload the configuration after the join so GTK still sees what the app asked for.
Main-thread cost, measured with a temporary log around the join (Testing build, Xvfb, warm cache, 8 launches):
| median | |
|---|---|
helper thread FcInit() |
3.8 ms (off main thread) |
| main thread wait at the join | 27 µs |
| reload when the app changed the env | 3.6 ms (only in that case) |
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed an intermittent crash at startup on Linux caused by a race between Pango and the main thread initializing fontconfig.
Backports
45-x-y
MergedPR Number
#53338Merged At
Aug 31, 2026, 2:39:06 PM
Released In
v45.0.0-alpha.3Release Date
Aug 31, 2026, 3:00:16 PM
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron