summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-06 08:34:03 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-06 09:04:55 +0200
commit57057f76add416d0faf2e09a90c126baafb6198e (patch)
tree07d54f8e5daeb3ed1161723542e94c324d745166 /src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
parentdc0ae02ebc8e221f952829230c0301a718a6f10b (diff)
parentfd70978693bd92761e9989bc1c76bf83c1e8c987 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
Diffstat (limited to 'src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp')
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index 382b9b1514..d5ea04bee8 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -111,9 +111,8 @@ QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool abs,
m_abs = getHardwareMaximum();
// socket notifier for events on the mouse device
- QSocketNotifier *notifier;
- notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
}
QEvdevMouseHandler::~QEvdevMouseHandler()
@@ -202,6 +201,14 @@ void QEvdevMouseHandler::readMouseData()
} else if (result < 0) {
if (errno != EINTR && errno != EAGAIN) {
qErrnoWarning(errno, "evdevmouse: Could not read from input device");
+ // If the device got disconnected, stop reading, otherwise we get flooded
+ // by the above error over and over again.
+ if (errno == ENODEV) {
+ delete m_notify;
+ m_notify = Q_NULLPTR;
+ qt_safe_close(m_fd);
+ m_fd = -1;
+ }
return;
}
} else {