[PATCH weston] window: Check for NULL surface in keyboard_handle_enter

Dima Ryazanov dima at gmail.com
Wed Nov 30 20:10:55 UTC 2016


This can happen if you right-click in weston-terminal a few times very quickly.
The pointer_handle_enter callback already checks for NULL, so let's do that in
keyboard_handle_enter, too.

Signed-off-by: Dima Ryazanov <dima at gmail.com>
---
 clients/window.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index ac35c3d..afc7cab 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3084,6 +3084,11 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
 	struct input *input = data;
 	struct window *window;
 
+	if (!surface) {
+		/* enter event for a window we've just destroyed */
+		return;
+	}
+
 	input->display->serial = serial;
 	input->keyboard_focus = wl_surface_get_user_data(surface);
 
-- 
2.9.3



More information about the wayland-devel mailing list