gdk: Keep a reference on the last source device
This device may go away, which means we have a pointer to a possibly stale object. Keep a reference here, and let future events bring this accounting up-to-date when the mouse pointer is next updated via other device. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/855
This commit is contained in:
parent
d2dd065b95
commit
a98001978c
@ -278,6 +278,7 @@ free_pointer_info (GdkPointerWindowInfo *info)
|
|||||||
{
|
{
|
||||||
if (info->toplevel_under_pointer)
|
if (info->toplevel_under_pointer)
|
||||||
g_object_unref (info->toplevel_under_pointer);
|
g_object_unref (info->toplevel_under_pointer);
|
||||||
|
g_clear_object (&info->last_slave);
|
||||||
g_slice_free (GdkPointerWindowInfo, info);
|
g_slice_free (GdkPointerWindowInfo, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9931,7 +9931,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
|||||||
|
|
||||||
if (source_device != pointer_info->last_slave &&
|
if (source_device != pointer_info->last_slave &&
|
||||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
|
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
|
||||||
pointer_info->last_slave = source_device;
|
g_set_object (&pointer_info->last_slave, source_device);
|
||||||
else if (pointer_info->last_slave)
|
else if (pointer_info->last_slave)
|
||||||
source_device = pointer_info->last_slave;
|
source_device = pointer_info->last_slave;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user