I think that gnome-terminal grab use-after-free after editing keyboard shortcuts may be not related to the patch "debian/patches/016_no_offscreen_widgets_grabbing.patch" (it only helps to report Critical to the log).
At the time of gtk_grab_add (called from gtk_cell_renderer_accel_start_editing which is called from gtk_cell_renderer_start_editing) this widget had window = 0x0 and parent = 0x0
And at time of gtk_grab_remove (called from gtk_cell_editable_event_box_key_press_event) same widget had window = 0x555555e507e0 (parent = 0x555555e183f0) which leads to incorrect deregistration of the grab.
Parent of the widget was changed by gtk_tree_view_multipress_gesture_pressed -> .. -> gtk_cell_area_activate_cell -> gtk_cell_area_add_editable -> ..signal.. -> gtk_tree_view_column_add_editable_callback -> _gtk_tree_view_add_editable -> gtk_tree_view_put -> gtk_widget_set_parent
Hello. I had some debugging with valgrind and gdb for the error with stacktrace top
g_type_ check_instance_ is_a glib2.0- 2.43.92/ ./gobject/ gtype.c: 4016 get_toplevel gtk+3.0- 3.14.9/ ./gtk/gtkwidget .c:11382 group_cleanup_ grabs gtk+3.0- 3.14.9/ ./gtk/gtkwindow group.c: 110 group_add_ window gtk+3.0- 3.14.9/ ./gtk/gtkwindow group.c: 169 set_transient_ for gtk+3.0- 3.14.9/ ./gtk/gtkwindow .c:3134
gtk_widget_
window_
gtk_window_
gtk_window_
This is use-after-free due to incorrect grab deregistration (gtk_grab_remove tries to remove the grab not from the same window_group where it was added by gtk_grab_add) /bugs.launchpad .net/ubuntu/ +source/ mate-terminal/ +bug/1667227 and https:/ /bugs.launchpad .net/ubuntu/ +source/ gnome-terminal/ +bug/1667232
Results were posted to Bug #1667227 and Bug #1667232
https:/
I think that gnome-terminal grab use-after-free after editing keyboard shortcuts may be not related to the patch "debian/ patches/ 016_no_ offscreen_ widgets_ grabbing. patch" (it only helps to report Critical to the log).
Both gtk_grab_add and gtk_grab_remove calls gtk_main_ get_window_ group function, but it returns different results for these two calls (more details at https:/ /bugs.launchpad .net/ubuntu/ +source/ mate-terminal/ +bug/1667227/ comments/ 8)
static GtkWindowGroup * get_window_ group (GtkWidget *widget) get_group (GTK_WINDOW (toplevel)); get_group (NULL);
gtk_main_
...
if (GTK_IS_WINDOW (toplevel))
return gtk_window_
else
return gtk_window_
At the time of gtk_grab_add (called from gtk_cell_ renderer_ accel_start_ editing which is called from gtk_cell_ renderer_ start_editing) this widget had window = 0x0 and parent = 0x0 editable_ event_box_ key_press_ event) same widget had window = 0x555555e507e0 (parent = 0x555555e183f0) which leads to incorrect deregistration of the grab.
And at time of gtk_grab_remove (called from gtk_cell_
Parent of the widget was changed by gtk_tree_ view_multipress _gesture_ pressed -> .. -> gtk_cell_ area_activate_ cell -> gtk_cell_ area_add_ editable -> ..signal.. -> gtk_tree_ view_column_ add_editable_ callback -> _gtk_tree_ view_add_ editable -> gtk_tree_view_put -> gtk_widget_ set_parent
So, gtk_cell_ area_activate_ cell of gtk+3 (3.22.7) has some kind of incorrect ordering of actions which broke gtk_grab_add / gtk_grab_remove pair /github. com/GNOME/ gtk/blob/ 6cc08d60efeb02a fc0d67982c3dc20 5dfd16d7cd/ gtk/gtkcellarea .c#L3388
https:/
3428 gtk_cell_ renderer_ start_editing (renderer, area_add_ editable (area, priv->focus_cell, editable_widget, cell_area);
...
3444 gtk_cell_
(There was also quick and probably incorrect fix in Bug #1667227 for this use-after-free with additional removing of grab from gtk_window_ get_group (NULL) https:/ /launchpadlibra rian.net/ 308873213/ lp1667227_ quick_fix_ gtk_grab_ remove. gtk+3.22. 8.patch )