From 4d75de006cde2ca428b7da1439e445f817fc7a29 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 5 Sep 2014 18:00:09 -0700 Subject: [PATCH] wayland: Don't set_focus when the device has been released It's possible for a released pointer to have repick / set_focus on it as part of sync_input_focus. When the pointer is actually re-init'd, it will memset 0, which can cause corruption as our destroy listener has already been added. Released devices should be idempotent, so just make sure method calls on them don't have any effect. --- src/wayland/meta-wayland-keyboard.c | 5 +++++ src/wayland/meta-wayland-pointer.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 7015faee8..1306bd3c0 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -380,6 +380,8 @@ meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard) wl_array_release (&keyboard->pressed_keys); g_object_unref (keyboard->settings); + + keyboard->display = NULL; } static void @@ -517,6 +519,9 @@ void meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, MetaWaylandSurface *surface) { + if (keyboard->display == NULL) + return; + if (keyboard->focus_surface == surface) return; diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index 27c3e8c72..4b0811a0f 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -216,6 +216,8 @@ meta_wayland_pointer_release (MetaWaylandPointer *pointer) { meta_wayland_pointer_set_focus (pointer, NULL); set_cursor_surface (pointer, NULL); + + pointer->display = NULL; } static int @@ -476,6 +478,9 @@ void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer, MetaWaylandSurface *surface) { + if (pointer->display == NULL) + return; + if (pointer->focus_surface == surface) return;