If the other peer requests data too fast (too rare/unlikely though),
we might receive multiple gdk_wayland_selection_request_target() calls
with no ending gdk_wayland_selection_check_write(), in which case the
fd is leaked as no GOutputStream was created to take over it.
https://bugzilla.gnome.org/show_bug.cgi?id=751414
wayland_selection->source_requested_target == target)
return FALSE;
+ /* If we didn't issue gdk_wayland_selection_check_write() yet
+ * on a previous fd, it will still linger here. Just close it,
+ * as we can't have more than one fd on the fly.
+ */
+ if (wayland_selection->stored_selection.fd >= 0)
+ close (wayland_selection->stored_selection.fd);
+
wayland_selection->stored_selection.fd = fd;
wayland_selection->source_requested_target = target;