[gtk/wip/carlosg/tablet-disconnects] gdk/wayland: Handle disorderly tablet/pad disconnects
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/tablet-disconnects] gdk/wayland: Handle disorderly tablet/pad disconnects
- Date: Fri, 15 May 2020 16:49:39 +0000 (UTC)
commit 948782b7e58a4ac923bf69f2f6f20893dcd4bf6f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 15 18:39:57 2020 +0200
gdk/wayland: Handle disorderly tablet/pad disconnects
If the tablet gets removed/freed while there are pad events in flight,
we leave a dangling pointer from the pad to the tablet, which may
lead to invalid reads/writes when handling the pad event(s).
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2748
gdk/wayland/gdkdevice-wayland.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 6b8529d872..7d81eaff3b 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2816,6 +2816,14 @@ _gdk_wayland_seat_remove_tablet (GdkWaylandSeat *seat,
zwp_tablet_v2_destroy (tablet->wp_tablet);
+ while (tablet->pads)
+ {
+ GdkWaylandTabletPadData *pad = tablet->pads->data;
+
+ pad->current_tablet = NULL;
+ tablet->pads = g_list_remove (tablet->pads, pad);
+ }
+
device_manager->devices =
g_list_remove (device_manager->devices, tablet->master);
device_manager->devices =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]