[mutter/wip/carlosg/issue-335: 25/25] wayland: Accept NULL primary data source



commit 60d22b7cd0827f4d8c04b7d06cf9e6523de4b18f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jan 15 19:13:27 2019 +0100

    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);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]