[mutter] wayland-keyboard: Disconnect from backend signals on release



commit 4aa74af6947121023a52445966b20a0e3ad7953c
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Apr 2 18:57:16 2015 +0200

    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 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index a62b4f3..e4d4f22 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]