[PATCH] touch-input: Don't dereference NULL pointer during full screen fade
Derek Foreman
derekf at osg.samsung.com
Fri Aug 29 11:18:54 PDT 2014
I should mention I don't have a touch capable screen and am only doing
partial testing with a modified version of libinput. More testing would
be nice. :)
On 29/08/14 01:12 PM, Derek Foreman wrote:
> If a full screen program is fading out and a touch start happens, it
> will result in a NULL pointer dereference when weston_touch_set_focus
> tries to derefernce view->surface->resource.
>
> Instead, this patch sets the focus to NULL, which should be the
> same as if the program was destroyed during the touch anyway.
>
> An additional test for NULL focus is added to prevent touch bindings
> from firing without a focus.
>
> Closes bug 78706
> ---
> src/input.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/input.c b/src/input.c
> index 975cd77..bcd603b 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -1419,8 +1419,14 @@ weston_touch_set_focus(struct weston_seat *seat, struct weston_view *view)
> }
>
> if (view) {
> - struct wl_client *surface_client =
> - wl_resource_get_client(view->surface->resource);
> + struct wl_client *surface_client;
> +
> + if (!view->surface->resource) {
> + seat->touch->focus = NULL;
> + return;
> + }
> +
> + surface_client = wl_resource_get_client(view->surface->resource);
> move_resources_for_client(focus_resource_list,
> &seat->touch->resource_list,
> surface_client);
> @@ -1479,8 +1485,9 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
> return;
> }
>
> - weston_compositor_run_touch_binding(ec, seat,
> - time, touch_type);
> + if (seat->touch->focus)
> + weston_compositor_run_touch_binding(ec, seat,
> + time, touch_type);
>
> grab->interface->down(grab, time, touch_id, sx, sy);
> if (touch->num_tp == 1) {
>
More information about the wayland-devel
mailing list