Root cause and one-line fix (verified on 24.04, gnome-terminal
3.52.0-1ubuntu2, Wayland, Yaru dark, "Use colors from system theme"
enabled).
The crash is in the Ubuntu-only debian/patches/scrollbar-background-
theming.patch, not in upstream gnome-terminal. In
terminal_screen_container_constructed() the patch does:
g_signal_connect_swapped (priv->screen, "notify::bg-color",
G_CALLBACK (gtk_widget_queue_draw),
priv->vscrollbar);
That handler is never disconnected. On "Detach Tab" the TerminalScreen
is moved into a new TerminalScreenContainer in a new window and the old
container (and its priv->vscrollbar) is destroyed, but the notify::bg-
color connection on the screen survives with a dangling widget pointer.
With theme colors enabled, the Yaru CSS gives `terminal-window
.terminal-screen:backdrop` a different background (#380c2a vs #300A24),
so as soon as the old window goes to backdrop during the detach,
update_color_scheme() sees bg change, emits notify::bg-color, and
gtk_widget_queue_draw() is called on freed memory:
#0 gtk_widget_queue_draw () from libgtk-3.so.0
#1 g_closure_invoke ()
...
#7 g_object_notify ()
#8 gnome-terminal-server (update_color_scheme)
Because every window lives in the single gnome-terminal-server process,
all terminals die together. This also explains the workarounds in this
thread: disabling "Use colors from system theme" (bg-color no longer
changes on focus/backdrop, so notify never fires) and hiding the
scrollbar.
Fix: let GLib drop the handler when the scrollbar is finalized by
connecting with g_signal_connect_object instead:
- g_signal_connect_swapped (priv->screen, "notify::bg-color",
- G_CALLBACK (gtk_widget_queue_draw),
priv->vscrollbar);
+ g_signal_connect_object (priv->screen, "notify::bg-color",
+ G_CALLBACK (gtk_widget_queue_draw),
priv->vscrollbar,
+ G_CONNECT_SWAPPED);
(Alternatively disconnect it in terminal_screen_container_dispose.) The
same unfixed line is still present in the patch in the current
development series (3.58.0-1ubuntu1), so this affects every Ubuntu
release that carries the patch; a fix in devel plus an SRU to noble
would be needed.
Duplicate: bug 2029100 is the same crash.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2049923
Title:
gnome-terminal freezing, then crashing
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/2049923/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs