input: fix access to invalid resource

the keyboard focus surface may not have a valid resource (server side
surface or a surface surviving its client), so check if it is valid
before using it.

Acked-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Giulio Camuffo 10 years ago committed by Pekka Paalanen
parent 0fd6d4ec53
commit de77e32b10
  1. 2
      src/input.c

@ -1800,7 +1800,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
seat->keyboard->focus_serial);
}
if (seat->keyboard->focus &&
if (seat->keyboard->focus && seat->keyboard->focus->resource &&
wl_resource_get_client(seat->keyboard->focus->resource) == client) {
struct weston_surface *surface =
(struct weston_surface *) seat->keyboard->focus;

Loading…
Cancel
Save