Commit 08f60dbc authored by Carlos Garnacho's avatar Carlos Garnacho

wayland: Improve EOF detection when reading selections

g_input_stream_read_bytes() roughly provides the same guarantees
than g_input_stream_read() wrt the number of bytes being possibly
read (i.e. it being a best effort, but no real guarantees).

Instead, rely on the 0-len read that we'd get at the end of the
transfer.

Fixes clipboard/DnD transfers possibly being cut short, resulting
on "Broken pipe" errors on the other side.

https://gitlab.gnome.org/GNOME/gtk/issues/1

Closes: #1
parent 63f534f4
......@@ -245,7 +245,7 @@ selection_buffer_read_cb (GObject *object,
if (bytes)
{
finished = g_bytes_get_size (bytes) < get_buffer_size ();
finished = g_bytes_get_size (bytes) == 0;
selection_buffer_append_data (buffer,
g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment