Skip to content

fix: initialize the system FontConfig before GTK starts on Linux - #53338

Merged
jkleinsc merged 2 commits into
45-x-yfrom
trop/45-x-y-bp-fix-initialize-the-system-fontconfig-before-gtk-starts-on-linux-1788198440501
Aug 31, 2026
Merged

jkleinsc merged 2 commits into
45-x-yfrom
trop/45-x-y-bp-fix-initialize-the-system-fontconfig-before-gtk-starts-on-linux-1788198440501

Conversation

@trop

@trop trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Backport of #53314

See that PR for details.

Notes: Fixed an intermittent crash at startup on Linux caused by a race between Pango and the main thread initializing fontconfig.

trop Bot and others added 2 commits August 31, 2026 17:47
Pango >= 1.52 spawns a thread that calls FcInit() as soon as GTK creates its
font map. 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, which later surfaces as a PartitionAlloc freelist
corruption check (SIGTRAP) or a NULL dereference inside expat.

Initialize the system FontConfig library 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 are no-ops. The symbol is resolved with
dlsym because the executable also contains Chromium's bundled FontConfig with
hidden visibility. If the app's main script changed the FontConfig
environment variables, the configuration is reloaded so GTK sees them.

Co-authored-by: Sam Attard <[email protected]>
@trop
trop Bot requested a review from MarshallOfSound August 31, 2026 17:47
@trop trop Bot added 45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Aug 31, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 31, 2026 18:36
@jkleinsc
jkleinsc disabled auto-merge August 31, 2026 19:38
@jkleinsc
jkleinsc merged commit 5933661 into 45-x-y Aug 31, 2026
95 checks passed
@release-clerk

release-clerk Bot commented Aug 31, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed an intermittent crash at startup on Linux caused by a race between Pango and the main thread initializing fontconfig.

@jkleinsc
jkleinsc deleted the trop/45-x-y-bp-fix-initialize-the-system-fontconfig-before-gtk-starts-on-linux-1788198440501 branch August 31, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants