From 5280bd86e2b29c00b97667929ff9901f7fdafde1 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 26 Aug 2014 14:44:02 -0500 Subject: [PATCH] touch-input: Don't dereference NULL pointer during full screen fade 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 just sets the focus to NULL, which should be the same as if the program was destroyed during the touch anyway. Closes bug 78706 --- src/input.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/input.c b/src/input.c index 975cd77..fc499c3 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); -- 2.1.0.rc1