patch 9.1.1587: Wayland: timeout not updated before select()

Commit: 
https://github.com/vim/vim/commit/1a224edb2e67bb50d00d4596925cea72b501b8e3
Author: Foxe Chen <chen.f...@gmail.com>
Date:   Thu Jul 24 19:29:13 2025 +0200

    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 <chen.f...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/clipboard.c b/src/clipboard.c
index 755275122..a22b62145 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 b0382651c..16148447b 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 bf0944375..b09ec5f6b 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)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uf007-0082Ra-VB%40256bit.org.

Raspunde prin e-mail lui