@@ -43,11 +43,14 @@ QInputDevice *QInputDeviceManagerPrivate::addMockDevice(const QString &devicePat
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
44void QInputDeviceManagerPrivate::removeDevice(const QString &path)
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);