Fix BroadcasterManager::RemoveListener to really remove the listener
authorReid Kleckner <rnk@google.com>
Tue, 4 Feb 2020 23:56:51 +0000 (15:56 -0800)
committerReid Kleckner <rnk@google.com>
Wed, 5 Feb 2020 01:19:44 +0000 (17:19 -0800)
This appears to be a real bug caught by -Wunused-value. std::find_if
doesn't modify the underlying collection, it just returns an iterator
pointing to the matching element.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D74010

lldb/source/Utility/Broadcaster.cpp

index 2a53394..de59a5c 100644 (file)
@@ -406,7 +406,7 @@ void BroadcasterManager::RemoveListener(Listener *listener) {
   listener_collection::iterator iter = m_listeners.begin(),
                                 end_iter = m_listeners.end();
 
-  std::find_if(iter, end_iter, predicate);
+  iter = std::find_if(iter, end_iter, predicate);
   if (iter != end_iter)
     m_listeners.erase(iter);