Summary
Menu::init_for_gtk_window overflows the main-thread stack (infinite recursion, ~37k frames) on Linux when the GTK appmenu-gtk-module is loaded via GTK_MODULES. This is the default on Ubuntu 26.04 GNOME (GTK_MODULES=gail:atk-bridge:appmenu-gtk-module), so any Tauri v2 app that sets a window menu crashes at startup there.
Observed in Lampese/codex-switcher 0.2.18 (muda 0.17.1, tauri 2.10.3, tauri-runtime-wry 2.10.1) — reported there too.
Repro
$ echo $GTK_MODULES
gail:atk-bridge:appmenu-gtk-module
$ codex-switcher
(codex-switcher:4109734): Gdk-CRITICAL **: gdk_wayland_window_set_dbus_properties_libgtk_only: assertion 'GDK_IS_WAYLAND_WINDOW (window)' failed
thread 'main' (4109734) has overflowed its stack
fatal runtime error: stack overflow, aborting
Workaround — drop the module and the app starts fine:
GTK_MODULES=gail:atk-bridge codex-switcher
Raising ulimit -s doesn't help (process pins 100% CPU and keeps recursing). GDK_BACKEND=x11 avoids the crash but the webview renders blank.
Backtrace (gdb, innermost frames are all in libgtk-3, elided)
#37732 g_signal_emit () from libgobject-2.0.so.0
#37733..#37738 ?? () from libgtk-3.so.0
#37739 ?? () from libgio-2.0.so.0
#37740 ?? () from libgobject-2.0.so.0
#37741 g_signal_emit_valist ()
#37742 g_signal_emit ()
#37743 g_menu_insert_item () from libgio-2.0.so.0
#37744 g_menu_insert_section () from libgio-2.0.so.0
#37745 ?? () from gtk-3.0/modules/libappmenu-gtk-module.so
#37746 ?? () from libgobject-2.0.so.0
#37747 g_signal_emit_valist ()
#37748 g_signal_emit ()
#37749 gtk_widget_realize () from libgtk-3.so.0
#37750 gtk_widget_set_parent () from libgtk-3.so.0
#37751 ?? () from libgtk-3.so.0
#37752 <muda::platform_impl::platform::Menu>::init_for_gtk_window::<gtk::auto::application_window::ApplicationWindow, gtk::auto::box_::Box> ()
#37753 <<tauri::window::Window>::set_menu::{closure#0} as core::ops::function::FnOnce<()>>::call_once ()
#37754 tauri_runtime_wry::handle_user_message::<tauri::EventLoopMessage> ()
#37755 tauri_runtime_wry::send_user_message::<tauri::EventLoopMessage> ()
#37756 <tauri::window::Window>::set_menu ()
#37757 <tauri::app::AppHandle>::set_menu ()
#37758 codex_switcher_lib::app_menu::refresh ()
#37759 codex_switcher_lib::run::{closure#0} ()
#37760 tauri::app::setup ()
...
#37771 main ()
Frames #0–#37731 are all ?? () from libgtk-3.so.0 — the appmenu module's realize handler inserts a section into the GMenu, which re-enters GTK and realizes again, forever.
Environment
- Ubuntu 26.04.1 LTS, GNOME Shell 50.1, Wayland session
- libgtk-3-0t64 3.24.52, libwebkit2gtk-4.1-0 2.52.6, appmenu-gtk3-module 25.04-1
- muda 0.17.1 / tauri 2.10.3 / tauri-runtime-wry 2.10.1
Summary
Menu::init_for_gtk_windowoverflows the main-thread stack (infinite recursion, ~37k frames) on Linux when the GTKappmenu-gtk-moduleis loaded viaGTK_MODULES. This is the default on Ubuntu 26.04 GNOME (GTK_MODULES=gail:atk-bridge:appmenu-gtk-module), so any Tauri v2 app that sets a window menu crashes at startup there.Observed in Lampese/codex-switcher 0.2.18 (muda 0.17.1, tauri 2.10.3, tauri-runtime-wry 2.10.1) — reported there too.
Repro
Workaround — drop the module and the app starts fine:
Raising
ulimit -sdoesn't help (process pins 100% CPU and keeps recursing).GDK_BACKEND=x11avoids the crash but the webview renders blank.Backtrace (gdb, innermost frames are all in libgtk-3, elided)
Frames #0–#37731 are all
?? () from libgtk-3.so.0— the appmenu module's realize handler inserts a section into the GMenu, which re-enters GTK and realizes again, forever.Environment