summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-09-28 14:25:36 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-09-28 16:22:32 +0200
commitcf88675807f15586cdc5544710fdea7067a85fad (patch)
tree26fb2ea08a814951b26d73e195234cc1bf6dc735
parent405f1ce3d07323fa1303416f322da7283160a7f9 (diff)
downloadmutter-cf88675807f15586cdc5544710fdea7067a85fad.tar.gz
wayland: Fix weak ref tracking on data sources
We may get a NULL one here, and we're wrongly attempting to remove the old weak ref from the new data source object.
-rw-r--r--src/wayland/meta-wayland-data-device.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 61acdc6d9..ae0fcf5eb 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -743,12 +743,14 @@ meta_wayland_data_device_set_dnd_source (MetaWaylandDataDevice *data_device,
return;
if (data_device->dnd_data_source)
- g_object_remove_weak_pointer (G_OBJECT (source),
+ g_object_remove_weak_pointer (G_OBJECT (data_device->dnd_data_source),
(gpointer *)&data_device->dnd_data_source);
data_device->dnd_data_source = source;
- g_object_add_weak_pointer (G_OBJECT (source),
- (gpointer *)&data_device->dnd_data_source);
+
+ if (source)
+ g_object_add_weak_pointer (G_OBJECT (data_device->dnd_data_source),
+ (gpointer *)&data_device->dnd_data_source);
wl_signal_emit (&data_device->dnd_ownership_signal, source);
}