codebytere

#54379: fix: stop leaking GDK_BACKEND into child processes on Linux

Merged
Created: Sep 25, 2026, 8:19:25 AM
Merged: Sep 25, 2026, 11:17:52 AM
4 comments
Target: main

Description of Change

Fixes #28436.

After this change processes an Electron app launches on Linux (shell.openExternal()'s xdg-open, child_process children, utility processes) no longer inherit a GDK_BACKEND the user did not set, so GTK apps opened from an X11 Electron app in a Wayland session start normally instead of reporting "already running" or falling back to XWayland.

Chromium's GTK integration sets GDK_BACKEND=x11 (or wayland) in the browser environment so gtk_init() picks the backend matching Ozone, and never restores it. #28898 fixed this in 2021 and was reverted in #29610.

This carries the upstream fix, https://chromium-review.googlesource.com/c/chromium/src/+/8468407, as a patch until it rolls in: the variable is set through a ScopedEnvironmentVariableOverride around gtk_init() (as GDK_GL already is) and restored afterwards. A Linux spec launches a fixture app with GDK_BACKEND unset and set to x11 and checks what a grandchild sees; before the patch the unset case reported x11.

Checklist

Release Notes

Notes: Fixed GDK_BACKEND leaking into processes spawned by Electron apps on Linux.

Backports

43-x-y
Pending
Waiting for a manual backport
44-x-y
Pending
Waiting for a manual backport
45-x-y
Pending
Waiting for a manual backport

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