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) ...@@ -288,12 +288,12 @@ void VideoV4l2ListThread::delDevice(const string &node)
{ {
ScopedLock lock(mutex_); ScopedLock lock(mutex_);
for (auto itr = devices_.begin(); itr != devices_.end(); ++itr) { const auto itr = std::find_if(devices_.begin(), devices_.end(),
if (itr->device == node) { [&] (const VideoV4l2Device &d) { return d.device == node; });
devices_.erase(itr);
Manager::instance().getVideoControls()->deviceEvent(); if (itr != devices_.end()) {
return; 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