window: Check for NULL surface in keyboard_handle_enter

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@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Dima Ryazanov 2016-11-30 12:10:55 -08:00 committed by Daniel Stone
parent db776dbecf
commit 3b7c207d06

View file

@ -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);