@@ -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}