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>
This commit is contained in:
parent
179d0d34fa
commit
bb2788d9f7
@ -188,17 +188,18 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QMetaType 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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user