Commit f238ce9c authored by Tristan Matthews's avatar Tristan Matthews

* #30216: video: find iterator, then erase item

Even though we don't continue iterating, this is a cleaner
way of removing the item.
parent 8c6089cb
......@@ -288,12 +288,12 @@ void VideoV4l2ListThread::delDevice(const string &node)
{
ScopedLock lock(mutex_);
for (auto itr = devices_.begin(); itr != devices_.end(); ++itr) {
if (itr->device == node) {
devices_.erase(itr);
Manager::instance().getVideoControls()->deviceEvent();
return;
}
const auto itr = std::find_if(devices_.begin(), devices_.end(),
[&] (const VideoV4l2Device &d) { return d.device == node; });
if (itr != devices_.end()) {
devices_.erase(itr);
Manager::instance().getVideoControls()->deviceEvent();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment