From 4aa74af6947121023a52445966b20a0e3ad7953c Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Thu, 2 Apr 2015 18:57:16 +0200 Subject: [PATCH] wayland-keyboard: Disconnect from backend signals on release Otherwise we'll access freed memory in the handlers. The wayland keyboard is released when the seat loses the keyboard capability which happens when leaving the VT so if there are keymap changes while switched away from the VT we would crash. https://bugzilla.gnome.org/show_bug.cgi?id=747263 --- src/wayland/meta-wayland-keyboard.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index a62b4f354..e4d4f2212 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -411,6 +411,11 @@ meta_wayland_xkb_info_destroy (MetaWaylandXkbInfo *xkb_info) void meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard) { + MetaBackend *backend = meta_get_backend (); + + g_signal_handlers_disconnect_by_func (backend, on_keymap_changed, keyboard); + g_signal_handlers_disconnect_by_func (backend, on_keymap_layout_group_changed, keyboard); + meta_wayland_keyboard_set_focus (keyboard, NULL); meta_wayland_xkb_info_destroy (&keyboard->xkb_info);