summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
index 333cafd5f..a2a5fdb52 100644
--- a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
+++ b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
@@ -430,7 +430,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
fl_selection_buffer_length[1] = rest+1000;
}
from = fl_selection_buffer[1];
- while (true) {
+ while (rest > 0) {
ssize_t n = read(fds[0], from, rest);
if (n <= 0) {
close(fds[0]);
@@ -438,6 +438,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
}
n = Fl_Screen_Driver::convert_crlf(from, n);
from += n;
+ rest -= n;
}
fl_selection_length[1] = from - fl_selection_buffer[1];
fl_selection_buffer[1][fl_selection_length[1]] = 0;