From c806dde7e61f4d06564bd3acf74dbba6cfa328c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 18 Jun 2012 12:09:47 -0400 Subject: [PATCH] data-device: Fix list corruption when the source goes away If the data source is destroyed, the corresponding offers may stay around for a little longer (until the owning client destroys it). When the offer is finally destroyed, we have to be careful to only remove the source destroy listener if the source hasn't yet been destroyed. Thanks to Martin Minarik for tracking down where the corruption happened. --- src/data-device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data-device.c b/src/data-device.c index a4bfa686..67ae41fd 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -70,7 +70,8 @@ destroy_data_offer(struct wl_resource *resource) { struct wl_data_offer *offer = resource->data; - wl_list_remove(&offer->source_destroy_listener.link); + if (offer->source) + wl_list_remove(&offer->source_destroy_listener.link); free(offer); }