Remove controllers when they are disconnected.
This commit is contained in:
parent
d91f4d2129
commit
2e02e3724c
1 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue