on xenial help sign in
Fix the rwrite to use iterators properly
commita1269607da89d9e7674c64bb4176d195cb28789c authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 2 Jan 2017, 09:48 (10 years ago) parent4a029dc
1 file changed+5−2
tests/mocks/Unity/InputInfo/qinputdeviceinfo_mock.cpp+5−2
tests/mocks/Unity/InputInfo/qinputdeviceinfo_mock.cpp+5−2
@@ -43,11 +43,14 @@ QInputDevice *QInputDeviceManagerPrivate::addMockDevice(const QString &devicePat
4343
4444void QInputDeviceManagerPrivate::removeDevice(const QString &path)
4545{
46− for (auto it = deviceMap.begin(); it != deviceMap.end(); ++it) {
46+ auto it = deviceMap.begin();
47+ while (it != deviceMap.end()) {
4748 const QString devicePath = it.key();
4849 if (devicePath.contains(path)) {
49− deviceMap.remove(devicePath);
50+ it = deviceMap.erase(it);
5051 Q_EMIT deviceRemoved(devicePath);
52+ } else {
53+ ++it;
5154 }
5255 }
5356}