--- ./xserver/hw/xwin/save_winclipboardthread.c 2005-07-04 23:10:43.000000000 +0100 +++ ./xserver/hw/xwin/winclipboardthread.c 2007-05-08 08:14:38.000000000 +0100 @@ -322,7 +322,7 @@ FD_SET (fdMessageQueue, &fdsRead); #else tvTimeout.tv_sec = 0; - tvTimeout.tv_usec = 100; + tvTimeout.tv_usec = 100000; #endif /* Wait for a Windows event or an X event */ @@ -358,7 +358,7 @@ } /* Branch on which descriptor became active */ - if (FD_ISSET (iConnectionNumber, &fdsRead)) + if (iReturn > 0 && FD_ISSET (iConnectionNumber, &fdsRead)) { /* Process X events */ /* Exit when we see that server is shutting down */ --- ./xserver/hw/xwin/save_winclipboardwndproc.c 2006-08-18 16:16:50.000000000 +0100 +++ ./xserver/hw/xwin/winclipboardwndproc.c 2007-05-22 15:57:33.000000000 +0100 @@ -36,6 +36,7 @@ #include "winclipboard.h" extern void winFixClipboardChain(); +extern void CheckConnections(); /* @@ -76,9 +77,11 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, Bool fUseUnicode, int iTimeoutSec) { - int iConnNumber; + fd_set fdsRead; struct timeval tv; + int iConnNumber; int iReturn; + int iSelectError; DWORD dwStopTime = (GetTickCount () / 1000) + iTimeoutSec; /* We need to ensure that all pending events are processed */ @@ -90,8 +93,6 @@ /* Loop for X events */ while (1) { - fd_set fdsRead; - /* Setup the file descriptor set */ FD_ZERO (&fdsRead); FD_SET (iConnNumber, &fdsRead); @@ -110,8 +111,20 @@ NULL, /* No write mask */ NULL, /* No exception mask */ &tv); /* No timeout */ - if (iReturn <= 0) +#ifdef HAS_WINSOCK + iSelectError = WSAGetLastError(); +#endif + if (iReturn == 0) + { + CheckConnections(); + ErrorF ("winProcessXEventsTimeout - Call to select () failed: timeout. Bailing.\n"); + break; + } + else if (iReturn < 0) { +#ifdef HAS_WINSOCK + if (iSelectError == WSAEINTR) continue; +#endif ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d. " "Bailing.\n", iReturn); break;