Reset touch focus in unmap
Otherwise, there will be race condition of visiting invalid surface data.
diff --git a/src/input.c b/src/input.c
index 1887e7f..704ec0d 100644
--- a/src/input.c
+++ b/src/input.c
@@ -983,8 +983,8 @@
weston_keyboard_end_grab(keyboard);
}
-static void
-touch_set_focus(struct weston_seat *seat, struct weston_surface *surface)
+WL_EXPORT void
+weston_touch_set_focus(struct weston_seat *seat, struct weston_surface *surface)
{
struct wl_resource *resource;
@@ -1045,7 +1045,7 @@
* until all touch points are up again. */
if (seat->num_tp == 1) {
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
- touch_set_focus(seat, es);
+ weston_touch_set_focus(seat, es);
} else if (touch->focus) {
es = (struct weston_surface *) touch->focus;
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
@@ -1074,7 +1074,7 @@
grab->interface->up(grab, time, touch_id);
if (seat->num_tp == 0)
- touch_set_focus(seat, NULL);
+ weston_touch_set_focus(seat, NULL);
break;
}
}