diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index c1ee3ce36c..e3a520e6c4 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -77,7 +77,7 @@ void UserInputMapper::registerDevice(InputDevice::Pointer device) { } const auto& deviceID = device->_deviceID; - recordDeviceOfType(device->getName()); + //recordDeviceOfType(device->getName()); qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID; @@ -134,6 +134,15 @@ void UserInputMapper::removeDevice(int deviceID) { _mappingsByDevice.erase(mappingsEntry); } + for (const auto& inputMapping : device->getAvailableInputs()) { + const auto& input = inputMapping.first; + auto endpoint = _endpointsByInput.find(input); + if (endpoint != _endpointsByInput.end()) { + _inputsByEndpoint.erase((*endpoint).second); + _endpointsByInput.erase(input); + } + } + _registeredDevices.erase(proxyEntry); emit hardwareChanged();