summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-01-17 13:18:53 +0100
committerRobert Mader <robert.mader@collabora.com>2022-02-14 15:36:08 +0100
commit6658e125300c724e2422a089bd2a266fcbd0efc6 (patch)
treea1ec9adb28a48eb2b71784f649a29871508301a7
parentbde931f04509ac6e0c82bd631afe44cf045bf76c (diff)
downloadmutter-6658e125300c724e2422a089bd2a266fcbd0efc6.tar.gz
wayland: Warn and fix accounting on missed CLUTTER_TOUCH_END events
If we happen to handle a CLUTTER_TOUCH_BEGIN without a corresponding CLUTTER_TOUCH_END at MetaWaylandTouch, we would still attempt to reuse the older MetaWaylandTouchInfo, resulting in an assert triggered as there is a stale touch reference on the previous surface. Warn in place and create a new touch info struct to still fix the broken surface accounting, instead of finding out the hard way after the surface is destroyed. The assert is preserved to ensure the accounting does not sneakily break anymore/further. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/584 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2251> (cherry picked from commit 7bf10de53847d974f38caa663057b8c0a2ed2e38)
-rw-r--r--src/wayland/meta-wayland-touch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 002ff16f7..730a054c9 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -177,8 +177,11 @@ touch_get_info (MetaWaylandTouch *touch,
touch_info = g_hash_table_lookup (touch->touches, sequence);
- if (!touch_info && create)
+ if (create)
{
+ if (touch_info != NULL)
+ g_warning ("Stale touch information for sequence slot %p", sequence);
+
touch_info = g_new0 (MetaWaylandTouchInfo, 1);
touch_info->slot = clutter_event_sequence_get_slot (sequence);
g_hash_table_insert (touch->touches, sequence, touch_info);