compositor-wayland: Ignore pointer enter on destroyed surface

Due to race conditions, it is (vanishingly unlikely but) possible to
receive a wl_pointer.enter event referring to a wl_surface we have just
destroyed. If this happens, wl_surface will be NULL. Detect this, clear
out our focus, and return.

Other pointer and keyboard events are robust against destroyed surfaces.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: remove call to input_set_cursor()]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Daniel Stone 7 years ago committed by Pekka Paalanen
parent 72e183bd2b
commit 3f83937414
  1. 7
      libweston/compositor-wayland.c

@ -1525,6 +1525,13 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
enum theme_location location; enum theme_location location;
double x, y; double x, y;
if (!surface) {
input->output = NULL;
input->has_focus = false;
notify_pointer_focus(&input->base, NULL, 0, 0);
return;
}
x = wl_fixed_to_double(fixed_x); x = wl_fixed_to_double(fixed_x);
y = wl_fixed_to_double(fixed_y); y = wl_fixed_to_double(fixed_y);

Loading…
Cancel
Save