summaryrefslogtreecommitdiff
path: root/src/wayland/meta-wayland-keyboard.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-21 11:30:02 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-10-11 22:51:54 +0800
commit578e5278697babdd9199c6dd1d6e1e46015541e4 (patch)
tree99b849ba074a2a2e6c2be3d82492086dda0a82c7 /src/wayland/meta-wayland-keyboard.c
parent312f215fc3d374c81ca24d619997e589184bb684 (diff)
downloadmutter-578e5278697babdd9199c6dd1d6e1e46015541e4.tar.gz
wayland/keyboard: Cleanup resource list management
Initialize on init(), unlink and reinitialize the list headers on disable() so that any delayed resource destruction doesn't affect future state. https://bugzilla.gnome.org/show_bug.cgi?id=771646
Diffstat (limited to 'src/wayland/meta-wayland-keyboard.c')
-rw-r--r--src/wayland/meta-wayland-keyboard.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 9531e8250..56e9576c1 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -608,9 +608,6 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
MetaBackend *backend = meta_get_backend ();
GSettingsSchema *schema;
- wl_list_init (&keyboard->resource_list);
- wl_list_init (&keyboard->focus_resource_list);
-
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
g_signal_connect (keyboard->settings, "changed",
G_CALLBACK (settings_changed), keyboard);
@@ -672,7 +669,10 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
meta_wayland_keyboard_set_focus (keyboard, NULL);
meta_wayland_xkb_info_destroy (&keyboard->xkb_info);
- /* XXX: What about keyboard->resource_list? */
+ wl_list_remove (&keyboard->resource_list);
+ wl_list_init (&keyboard->resource_list);
+ wl_list_remove (&keyboard->focus_resource_list);
+ wl_list_init (&keyboard->focus_resource_list);
g_clear_object (&keyboard->settings);
if (keyboard->gsd_settings)
@@ -963,6 +963,9 @@ meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
static void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard)
{
+ wl_list_init (&keyboard->resource_list);
+ wl_list_init (&keyboard->focus_resource_list);
+
meta_wayland_xkb_info_init (&keyboard->xkb_info);
keyboard->default_grab.interface = &default_keyboard_grab_interface;