on xenial help sign in
Fix the rwrite to use iterators properly
a126960Albert Astals Cid
tests/mocks/Unity/InputInfo/qinputdeviceinfo_mock.cpp+5−2
@@ -43,11 +43,14 @@ QInputDevice *QInputDeviceManagerPrivate::addMockDevice(const QString &devicePat
43
43
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
45{
45{
46− for (auto it = deviceMap.begin(); it != deviceMap.end(); ++it) {
46+ auto it = deviceMap.begin();
47+ while (it != deviceMap.end()) {
47 const QString devicePath = it.key();
48 const QString devicePath = it.key();
48 if (devicePath.contains(path)) {
49 if (devicePath.contains(path)) {
49− deviceMap.remove(devicePath);
50+ it = deviceMap.erase(it);
50 Q_EMIT deviceRemoved(devicePath);
51 Q_EMIT deviceRemoved(devicePath);
52+ } else {
53+ ++it;
51 }
54 }
52 }
55 }
53}
56}