From 47601f5413faf8ce0a5e52e71862f00e10033f08 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Sun, 11 Feb 2024 13:03:39 +0000 Subject: [PATCH] gdk/wayland: Clear current_tablet on pad leave Fixes crash when handling tablet pad removal event after the current_tablet has already been freed. --- gdk/wayland/gdkdevice-wayland.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 824e9aa93c..7c4c926ce8 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -4560,7 +4560,10 @@ tablet_pad_handle_leave (void *data, wp_tablet_pad, surface)); if (pad->current_tablet) - pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad); + { + pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad); + pad->current_tablet = NULL; + } } static void