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>
This commit is contained in:
Daniel Stone 2018-03-09 10:08:37 +00:00 committed by Pekka Paalanen
parent 72e183bd2b
commit 3f83937414
1 changed files with 7 additions and 0 deletions

View File

@ -1525,6 +1525,13 @@ input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
enum theme_location location;
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);
y = wl_fixed_to_double(fixed_y);