From 075c77325b051e9257d19ab31886755507d599dc Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 8 Oct 2019 17:56:10 +0200 Subject: [PATCH] gdk: Avoid poking possibly freed memory The event may end up freed after delivery, ensure to keep a ref in order to emit the matching emulated crossed event matching a proximity event. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157 --- gdk/wayland/gdkdevice-wayland.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 7a7031d882..1b66f37b3a 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -3327,6 +3327,8 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet, if (!event) return; + g_object_ref (event); + switch ((guint) event->any.type) { case GDK_MOTION_NOTIFY: @@ -3367,6 +3369,8 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet, emulate_crossing (event->any.surface, NULL, tablet->master, GDK_ENTER_NOTIFY, GDK_CROSSING_NORMAL, time); + + g_object_unref (event); } static GdkEvent *