[mutter] wayland/touch: Remove undelivered touches earlier
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/touch: Remove undelivered touches earlier
- Date: Thu, 28 Feb 2019 09:59:53 +0000 (UTC)
commit 8d9a5e3c7ea1d186978ae7056b6c12d79b377b21
Author: Jonas Dreßler <verdre v0yd nl>
Date: Tue Feb 19 12:16:29 2019 +0100
wayland/touch: Remove undelivered touches earlier
When the touch_down event was not delivered to Wayland clients, there's
no point in keeping the touchpoint in our list, so remove it early
inside update() instead of removing it after the touch ended.
This fixes a crash inside touch_handle_surface_destroy() where the
assertion to make sure the surface is removed fails because the
touch_count of the surface never reached 0. This in turn happened
because a new sequence was added, while a (already ended one) wasn't
removed from the touch->touches list before. This caused the touch
counter to get incremented by 1 while no new sequence was added to the
list (because Clutter reuses sequence IDs, the old sequence is equal to
the new one, i.e. the new sequence already is present in the list).
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/200
https://gitlab.gnome.org/GNOME/mutter/merge_requests/426
src/wayland/meta-wayland-touch.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 01ed9b015..5ea4c4b27 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -243,6 +243,13 @@ meta_wayland_touch_update (MetaWaylandTouch *touch,
if (!touch_info)
return;
+ if (event->type != CLUTTER_TOUCH_BEGIN &&
+ !touch_info->begin_delivered)
+ {
+ g_hash_table_remove (touch->touches, sequence);
+ return;
+ }
+
if (event->type == CLUTTER_TOUCH_BEGIN ||
event->type == CLUTTER_TOUCH_END)
{
@@ -302,7 +309,7 @@ handle_touch_update (MetaWaylandTouch *touch,
sequence = clutter_event_get_event_sequence (event);
touch_info = touch_get_info (touch, sequence, FALSE);
- if (!touch_info || !touch_info->begin_delivered)
+ if (!touch_info)
return;
l = &touch_info->touch_surface->resource_list;
@@ -333,15 +340,12 @@ handle_touch_end (MetaWaylandTouch *touch,
if (!touch_info)
return;
- if (touch_info->begin_delivered)
+ l = &touch_info->touch_surface->resource_list;
+ wl_resource_for_each (resource, l)
{
- l = &touch_info->touch_surface->resource_list;
- wl_resource_for_each(resource, l)
- {
- wl_touch_send_up (resource, touch_info->slot_serial,
- clutter_event_get_time (event),
- touch_info->slot);
- }
+ wl_touch_send_up (resource, touch_info->slot_serial,
+ clutter_event_get_time (event),
+ touch_info->slot);
}
g_hash_table_remove (touch->touches, sequence);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]