From 1a224edb2e67bb50d00d4596925cea72b501b8e3 Mon Sep 17 00:00:00 2001 From: Foxe Chen Date: Thu, 24 Jul 2025 19:29:13 +0200 Subject: [PATCH] patch 9.1.1587: Wayland: timeout not updated before select() Problem: Wayland: timeout not updated before select() Solution: Always set timeval struct before select() (Foxe Chen). closes: #17836 Signed-off-by: Foxe Chen Signed-off-by: Christian Brabandt --- src/clipboard.c | 12 +++++++++--- src/version.c | 2 ++ src/wayland.c | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/clipboard.c b/src/clipboard.c index 7552751225..a22b621452 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -2352,8 +2352,6 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd) FD_ZERO(&rfds); FD_SET(fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = p_wtm * 1000; #endif // Make pipe (read end) non-blocking @@ -2381,10 +2379,13 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd) poll_data: #ifndef HAVE_SELECT if (poll(&pfd, 1, p_wtm) > 0) + continue; #else + tv.tv_sec = 0; + tv.tv_usec = p_wtm * 1000; if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0) -#endif continue; +#endif } break; } @@ -2617,6 +2618,11 @@ clip_wl_send_data( if (written == -1) break; total += written; + +#ifdef HAVE_SELECT + tv.tv_sec = 0; + tv.tv_usec = p_wtm * 1000; +#endif } exit: vim_free(string); diff --git a/src/version.c b/src/version.c index b0382651c5..16148447b0 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1587, /**/ 1586, /**/ diff --git a/src/wayland.c b/src/wayland.c index bf09443757..b09ec5f6b9 100644 --- a/src/wayland.c +++ b/src/wayland.c @@ -422,6 +422,10 @@ vwl_display_flush(vwl_display_T *display) if (select(display->fd + 1, NULL, &wfds, NULL, &tv) <= 0) #endif return FAIL; +#ifdef HAVE_SELECT + tv.tv_sec = 0; + tv.tv_usec = p_wtm * 1000; +#endif } // Return FAIL on error or timeout if ((errno != 0 && errno != EAGAIN) || ret == -1) -- 2.47.2