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.
This commit is contained in:
Kristian Høgsberg 2012-06-18 12:09:47 -04:00
parent b576443a0e
commit c806dde7e6

View file

@ -70,6 +70,7 @@ destroy_data_offer(struct wl_resource *resource)
{
struct wl_data_offer *offer = resource->data;
if (offer->source)
wl_list_remove(&offer->source_destroy_listener.link);
free(offer);
}