Bug can be detected by "Gtk-CRITICAL **: gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed" messages, when mate-terminal or gnome-terminal are started from another console (with option --disable-factory) and keyboard shortcuts are edited. I have such messages with gtk+3 (upstream) versions 3.16.7, 3.18.9, 3.20.9, 3.22.8; valgrind can detect invalid reads (use after free) from window_group_cleanup_grabs -> gtk_widget_get_toplevel.
Simple, but potentially incorrect patch corrects this bug (both Gtk-CRITICAL messages and valgrind detections/SIGSEGVs) in mate-terminal and gnome-terminal (bug #1667232). It is tested with gtk+3 3.16.7, 3.18.9, 3.20.9, 3.22.8. Just call _gtk_window_group_remove_grab from gtkmain.c:gtk_grab_remove twice, additional call with default window group, to clear all possible references to the widget from the grabs list: diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 3152971256..681cb2bec9 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -2274,6 +2274,9 @@ gtk_grab_remove (GtkWidget *widget) group = gtk_main_get_window_group (widget); _gtk_window_group_remove_grab (group, widget); + // quick workaround for lp #1667227, lp #1667232 + _gtk_window_group_remove_grab (gtk_window_get_group (NULL), widget); + new_grab_widget = gtk_window_group_get_current_grab (group); gtk_grab_notify (group, NULL, widget, new_grab_widget, FALSE); -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to gtk+3.0 in Ubuntu. https://bugs.launchpad.net/bugs/1667227 Title: mate-terminal crashed with SIGSEGV in g_type_check_instance_is_a() - while editing Keyboard Shortcuts Status in gnome-terminal package in Ubuntu: New Status in gtk+3.0 package in Ubuntu: New Status in mate-terminal package in Ubuntu: New Bug description: 1) $ lsb_release -rd Description: Ubuntu Zesty Zapus (development branch) Release: 17.04 Installed as Ubuntu-MATE 17.04 "Zesty Zapus" - Alpha amd64 2) $ apt-cache policy mate-terminal mate-terminal: Installed: 1.17.0-0ubuntu1 Candidate: 1.17.0-0ubuntu1 3) Open mate-terminal Select "Edit" -> "Keyboard Shortcuts" Select "Help"->"Contents", click on default shortcut key "F1" to change Try to set it to various key sequences. Sometimes bug is triggered by pressing "Fn" key with some of Alt/Ctrl/Shift, sometimes by selecting Ctrl-Shift-W / Crtl-Shift-Alt-W Expected: changed keyboard shortcut for "Help"->"Contents" 4) Abort and closed mate-terminal ProblemType: Crash DistroRelease: Ubuntu 17.04 Package: mate-terminal 1.17.0-0ubuntu1 ProcVersionSignature: Ubuntu 4.10.0-8.10-generic 4.10.0-rc8 Uname: Linux 4.10.0-8-generic x86_64 ApportVersion: 2.20.4-0ubuntu2 Architecture: amd64 CurrentDesktop: MATE Date: Thu Feb 23 09:33:19 2017 ExecutablePath: /usr/bin/mate-terminal ExecutableTimestamp: 1484233434 InstallationDate: Installed on 2017-02-22 (1 days ago) InstallationMedia: Ubuntu-MATE 17.04 "Zesty Zapus" - Alpha amd64 (20170125) ProcCmdline: mate-terminal ProcCwd: /home/user SegvAnalysis: Segfault happened at: 0x7f883e41c321 <g_type_check_instance_is_a+65>: testb $0x4,0x16(%rax) PC (0x7f883e41c321) ok source "$0x4" ok destination "0x16(%rax)" (0x70000001e) not located in a known VMA region (needed writable region)! SegvReason: writing unknown VMA Signal: 11 SourcePackage: mate-terminal StacktraceTop: g_type_check_instance_is_a () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 gtk_widget_get_toplevel () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 gtk_window_group_add_window () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 gtk_window_set_transient_for () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 Title: mate-terminal crashed with SIGSEGV in g_type_check_instance_is_a() UpgradeStatus: No upgrade log present (probably fresh install) UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1667227/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp