wayland: Ensure tablet objects tear down resources properly

Otherwise the resource is still linked to a wl_list whose storage
has been freed, leading to invalid writes.
This commit is contained in:
Carlos Garnacho 2016-05-10 15:24:41 +02:00
parent 2c13ae2b59
commit ccf6dcd865
3 changed files with 12 additions and 0 deletions

View File

@ -192,6 +192,14 @@ meta_wayland_tablet_seat_new (MetaWaylandTabletManager *manager)
void
meta_wayland_tablet_seat_free (MetaWaylandTabletSeat *tablet_seat)
{
struct wl_resource *resource, *next;
wl_resource_for_each_safe (resource, next, &tablet_seat->resource_list)
{
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_signal_handlers_disconnect_by_data (tablet_seat->device_manager,
tablet_seat);
g_hash_table_destroy (tablet_seat->tablets);

View File

@ -411,6 +411,8 @@ meta_wayland_tablet_tool_free (MetaWaylandTabletTool *tool)
wl_resource_for_each_safe (resource, next, &tool->resource_list)
{
zwp_tablet_tool_v1_send_removed (resource);
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_slice_free (MetaWaylandTabletTool, tool);

View File

@ -62,6 +62,8 @@ meta_wayland_tablet_free (MetaWaylandTablet *tablet)
wl_resource_for_each_safe (resource, next, &tablet->resource_list)
{
zwp_tablet_v1_send_removed (resource);
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_slice_free (MetaWaylandTablet, tablet);