[gtk+] wayland: close() the selection fd if we didn't start writing yet
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: close() the selection fd if we didn't start writing yet
- Date: Wed, 24 Jun 2015 21:54:33 +0000 (UTC)
commit 3bd7b2a6fb31a3cf379466b08c497552f0c27c0f
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jun 24 21:52:23 2015 +0200
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
gdk/wayland/gdkselection-wayland.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index 86bfde2..c5d0089 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]