Skip to content

fix: use GTK UI theme for Linux message boxes#52238

Merged
VerteDinde merged 1 commit into
electron:mainfrom
scarab-systems:scarab-systems/electron-51988-gtk-messagebox-platform-v2
Jul 21, 2026
Merged

fix: use GTK UI theme for Linux message boxes#52238
VerteDinde merged 1 commit into
electron:mainfrom
scarab-systems:scarab-systems/electron-51988-gtk-messagebox-platform-v2

Conversation

@scarab-systems

@scarab-systems scarab-systems commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description of Change

Fixes #51988.

Linux message boxes need the GTK GtkUiPlatform, but this helper was casting
the active LinuxUi singleton to gtk::GtkUi. When another Linux UI
implementation is active, that can use the wrong object for the GTK message box
path.

This change requests the GTK Linux UI theme directly with
ui::GetLinuxUiTheme(ui::SystemTheme::kGtk) before retrieving its platform, and
checks both the GTK UI and platform pointers before use.

Validation performed:

  • yarn lint:cpp --only -- shell/browser/ui/message_box_gtk.cc
  • third_party/ninja/ninja -C out/LinuxTesting obj/electron/electron_lib/message_box_gtk.o

For the object rebuild, the prior message_box_gtk.o and message_box_gtk.dwo
outputs were removed first so Ninja rebuilt the changed C++ file.

No tests or documentation were changed. This patch is limited to the internal
Linux GTK message box platform lookup and does not add or change public API
behavior.

Checklist

Release Notes

Notes: Fixed a crash when showing Linux message boxes while another Linux UI implementation was active.

Look up the GTK-specific Linux UI theme before accessing the
GtkUiPlatform instead of casting the active LinuxUi singleton. This keeps
GTK message boxes on the GTK platform path even when the active Linux UI
implementation is not GTK.

Assisted-By: OpenAI Codex
Signed-off-by: Scarab Systems <[email protected]>
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jul 2, 2026
@0x9fff00

0x9fff00 commented Jul 7, 2026

Copy link
Copy Markdown

Arch Linux applied this patch in version 42.6.0-1 of its electron42 package and I can confirm that it fixes #51988.

@scarab-systems

Copy link
Copy Markdown
Contributor Author

Thanks @0x9fff00 for checking this downstream and linking the Arch package patch. That external confirmation is helpful.

I’ll leave this open for Electron maintainer direction, and I’m happy to adjust the patch if maintainers want a different shape.

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Jul 9, 2026

@nikwen nikwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamping based on @mitchchn's review (and the change looks reasonable to me).

@VerteDinde VerteDinde added target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. semver/patch backwards-compatible bug fixes labels Jul 21, 2026
@VerteDinde
VerteDinde enabled auto-merge (squash) July 21, 2026 01:02
@VerteDinde
VerteDinde merged commit 2cd3a56 into electron:main Jul 21, 2026
92 checks passed
@welcome

welcome Bot commented Jul 21, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk

release-clerk Bot commented Jul 21, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash when showing Linux message boxes while another Linux UI implementation was active.

@trop

trop Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #52408

@trop trop Bot removed the target/42-x-y PR should also be added to the "42-x-y" branch. label Jul 21, 2026
@trop

trop Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #52409

@trop

trop Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #52410

@trop trop Bot added in-flight/43-x-y and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. labels Jul 21, 2026
@scarab-systems

Copy link
Copy Markdown
Contributor Author

Congrats on merging your first pull request! 🎉🎉🎉

Woohoo! Thank you so much! 🙏 Scarab

@scarab-systems
scarab-systems deleted the scarab-systems/electron-51988-gtk-messagebox-platform-v2 branch July 21, 2026 01:45
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/42-x-y in-flight/43-x-y in-flight/44-x-y labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attempting to show a message box segfaults when using Qt backend

5 participants