gdk: Fix wl_output accounting on tablet devices
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 8 Oct 2019 15:46:38 +0000 (17:46 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 8 Oct 2019 15:59:57 +0000 (17:59 +0200)
The code managing this accounting mixed seat and tablet output lists,
can't bode well. Fixes invalid reads on list elements, as there are
dangling pointers.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
gdk/wayland/gdkdevice-wayland.c

index d90d13332120985ee4c7eebbf65f3553ab6a841c..7a7031d882bea9acc33546d796e7977b6f571e0c 100644 (file)
@@ -4490,7 +4490,7 @@ pointer_surface_enter (void              *data,
   if (tablet)
     {
       tablet->pointer_info.pointer_surface_outputs =
-        g_slist_append (seat->pointer_info.pointer_surface_outputs, output);
+        g_slist_append (tablet->pointer_info.pointer_surface_outputs, output);
     }
   else
     {
@@ -4519,7 +4519,7 @@ pointer_surface_leave (void              *data,
   if (tablet)
     {
       tablet->pointer_info.pointer_surface_outputs =
-        g_slist_remove (seat->pointer_info.pointer_surface_outputs, output);
+        g_slist_remove (tablet->pointer_info.pointer_surface_outputs, output);
     }
   else
     {