[PATCH] compositor-wayland: Ignore pointer enter on destroyed surface

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 9 14:08:54 UTC 2018


On Fri,  9 Mar 2018 10:08:37 +0000
Daniel Stone <daniels at collabora.com> wrote:

> 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 at collabora.com>
> Cc: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> ---
>  libweston/compositor-wayland.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> index 9c401d2e6..964b84e4b 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -1525,6 +1525,14 @@ 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);
> +		input_set_cursor(input);
> +		return;
> +	}
> +
>  	x = wl_fixed_to_double(fixed_x);
>  	y = wl_fixed_to_double(fixed_y);
>  

Hi Daniel,

looks good, but what is the input_set_cursor() call doing there?


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180309/7d8efa42/attachment.sig>


More information about the wayland-devel mailing list