[Lldb-commits] [lldb] 50d2d33 - Fix BroadcasterManager::RemoveListener to really remove the listener

Reid Kleckner via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 4 17:19:51 PST 2020


Author: Reid Kleckner
Date: 2020-02-04T17:19:44-08:00
New Revision: 50d2d33b8ef530fbee369cbf8e7ea4479597742d

URL: https://github.com/llvm/llvm-project/commit/50d2d33b8ef530fbee369cbf8e7ea4479597742d
DIFF: https://github.com/llvm/llvm-project/commit/50d2d33b8ef530fbee369cbf8e7ea4479597742d.diff

LOG: Fix BroadcasterManager::RemoveListener to really remove the listener

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

Added: 
    

Modified: 
    lldb/source/Utility/Broadcaster.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Utility/Broadcaster.cpp b/lldb/source/Utility/Broadcaster.cpp
index 2a5339482772..de59a5c4362e 100644
--- a/lldb/source/Utility/Broadcaster.cpp
+++ b/lldb/source/Utility/Broadcaster.cpp
@@ -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);
 


        


More information about the lldb-commits mailing list