From f238ce9cecfd0a74eca6f6b2bf4aa4167ae4e345 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Tue, 17 Sep 2013 15:14:56 -0400
Subject: [PATCH] * #30216: video: find iterator, then erase item

Even though we don't continue iterating, this is a cleaner
way of removing the item.
---
 daemon/src/video/video_v4l2_list.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/daemon/src/video/video_v4l2_list.cpp b/daemon/src/video/video_v4l2_list.cpp
index 2a811890bc..e7e704a418 100644
--- a/daemon/src/video/video_v4l2_list.cpp
+++ b/daemon/src/video/video_v4l2_list.cpp
@@ -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();
     }
 }
 
-- 
GitLab