From 60d22b7cd0827f4d8c04b7d06cf9e6523de4b18f Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 15 Jan 2019 19:13:27 +0100 Subject: [PATCH] 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 --- src/wayland/meta-wayland-data-device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index 648b8d80e..f0c70b04a 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -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); }