Remove controllers when they are disconnected.

This commit is contained in:
Micke Prag 2010-10-15 13:51:52 +00:00
parent d91f4d2129
commit 2e02e3724c

View file

@ -37,7 +37,19 @@ void ControllerManager::deviceInsertedOrRemoved(int vid, int pid, bool inserted)
}
if (inserted) {
loadControllers();
return;
} else {
TelldusCore::MutexLocker locker(&d->mutex);
for(ControllerMap::const_iterator it = d->controllers.begin(); it != d->controllers.end(); ++it) {
TellStick *tellstick = reinterpret_cast<TellStick*>(it->second);
if (!tellstick) {
continue;
}
if (!tellstick->stillConnected()) {
d->controllers.erase(it);
delete tellstick;
break;
}
}
}
}