wayland: Accept NULL primary data source

A NULL argument is expected here in order to unset the selection,
meta_wayland_data_device_set_primary() accepts a NULL source, but
gtk_primary_selection_device.set_selection was not handling a
NULL wl_resource.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/335
This commit is contained in:
Carlos Garnacho 2019-01-15 19:13:27 +01:00 committed by Jonas Ådahl
parent e9778eba18
commit 60d22b7cd0

View File

@ -1734,9 +1734,10 @@ primary_device_set_selection (struct wl_client *client,
uint32_t serial)
{
MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource);
MetaWaylandDataSource *source;
MetaWaylandDataSource *source = NULL;
source = wl_resource_get_user_data (source_resource);
if (source_resource)
source = wl_resource_get_user_data (source_resource);
meta_wayland_data_device_set_primary (data_device, source, serial);
}