Projects
Eulaceura:Mainline:GA
qt5-qtwayland
_service:obs_scm:0026-use-poll-2-when-reading-f...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0026-use-poll-2-when-reading-from-clipboard.patch of Package qt5-qtwayland
From ddfa956f6c39c53249116b979f679b255ed4a596 Mon Sep 17 00:00:00 2001 From: Kenneth Topp <ken@bllue.org> Date: Mon, 4 Apr 2022 09:36:21 -0400 Subject: [PATCH 26/51] use poll(2) when reading from clipboard change clipboard read away from select(2) call which can fail when an application has large number of open files Change-Id: I6d98c6bb11cdd5b6171b01cfeb0044dd41cf9fb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 829a9f62a96721c142f53e12a8812e8231b20317) --- src/client/qwaylanddataoffer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp index c9e158cc..fe0ea8c9 100644 --- a/src/client/qwaylanddataoffer.cpp +++ b/src/client/qwaylanddataoffer.cpp @@ -188,17 +188,18 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T int QWaylandMimeData::readData(int fd, QByteArray &data) const { - fd_set readset; - FD_ZERO(&readset); - FD_SET(fd, &readset); - struct timeval timeout; + struct pollfd readset; + readset.fd = fd; + readset.events = POLLIN; + struct timespec timeout; timeout.tv_sec = 1; - timeout.tv_usec = 0; + timeout.tv_nsec = 0; + Q_FOREVER { - int ready = select(FD_SETSIZE, &readset, nullptr, nullptr, &timeout); + int ready = qt_safe_poll(&readset, 1, &timeout); if (ready < 0) { - qWarning() << "QWaylandDataOffer: select() failed"; + qWarning() << "QWaylandDataOffer: qt_safe_poll() failed"; return -1; } else if (ready == 0) { qWarning("QWaylandDataOffer: timeout reading from pipe"); -- 2.40.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2