#6409 Time out read events for clipboard

This commit is contained in:
Nathan Neulinger 2019-07-02 10:27:23 -05:00 committed by Jnewbon
parent fc20b5e237
commit 0395c8593b
1 changed files with 6 additions and 0 deletions

View File

@ -1333,6 +1333,12 @@ XWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
// process events if any otherwise sleep // process events if any otherwise sleep
if (noWait || XPending(display) > 0) { if (noWait || XPending(display) > 0) {
while (!m_done && !m_failed && (noWait || XPending(display) > 0)) { while (!m_done && !m_failed && (noWait || XPending(display) > 0)) {
// fail if timeout has expired
if (timeout.getTime() >= s_timeout) {
m_failed = true;
break;
}
XNextEvent(display, &xevent); XNextEvent(display, &xevent);
if (!processEvent(display, &xevent)) { if (!processEvent(display, &xevent)) {
// not processed so save it // not processed so save it