Skip to content
Snippets Groups Projects
Commit f238ce9c authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #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
Branches
Tags
No related merge requests found
...@@ -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; });
if (itr != devices_.end()) {
devices_.erase(itr); devices_.erase(itr);
Manager::instance().getVideoControls()->deviceEvent(); Manager::instance().getVideoControls()->deviceEvent();
return;
}
} }
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment