[PATCH weston 3/3] clipboard: set fd member of clipboard_source

Marek Chalupa mchqwerty at gmail.com
Fri Dec 5 04:49:42 PST 2014


The fd member of clipboard_source structure was not set
but was used in close().

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 src/clipboard.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/clipboard.c b/src/clipboard.c
index dbd8c9b..a9747b9 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -63,6 +63,7 @@ clipboard_source_unref(struct clipboard_source *source)
 		wl_event_source_remove(source->event_source);
 		close(source->fd);
 	}
+
 	wl_signal_emit(&source->base.destroy_signal,
 		       &source->base);
 	s = source->base.mime_types.data;
@@ -151,6 +152,7 @@ clipboard_source_create(struct clipboard *clipboard,
 	source->refcount = 1;
 	source->clipboard = clipboard;
 	source->serial = serial;
+	source->fd = fd;
 
 	s = wl_array_add(&source->base.mime_types, sizeof *s);
 	if (s == NULL)
@@ -199,6 +201,8 @@ clipboard_client_data(int fd, uint32_t mask, void *data)
 	if (client->offset == size || len <= 0) {
 		close(fd);
 		wl_event_source_remove(client->event_source);
+		client->event_source = NULL;
+
 		clipboard_source_unref(client->source);
 		free(client);
 	}
-- 
2.1.0



More information about the wayland-devel mailing list