forked from AuroraMiddleware/gtk
wayland: close() the selection fd if we didn't start writing yet
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
This commit is contained in:
parent
5e7159413d
commit
3bd7b2a6fb
@ -567,6 +567,13 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user