summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 07303f4e22..8a9e7a55c0 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -355,8 +355,11 @@ void QXcbConnection::xi2Select(xcb_window_t window)
XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
{
- XInput2TouchDeviceData *dev = m_touchDevices[id];
- if (!dev) {
+ XInput2TouchDeviceData *dev = Q_NULLPTR;
+ QHash<int, XInput2TouchDeviceData*>::const_iterator devIt = m_touchDevices.find(id);
+ if ( devIt != m_touchDevices.end() ) {
+ dev = devIt.value();
+ } else {
int nrDevices = 0;
QTouchDevice::Capabilities caps = 0;
dev = new XInput2TouchDeviceData;
@@ -428,7 +431,6 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
QWindowSystemInterface::registerTouchDevice(dev->qtTouchDevice);
m_touchDevices[id] = dev;
} else {
- m_touchDevices.remove(id);
XIFreeDeviceInfo(dev->xiDeviceInfo);
delete dev;
dev = 0;