From 24b3b7e3d4d0c65cbd729bd29c462765d5a74e34 Mon Sep 17 00:00:00 2001 From: vjpai <vpai@google.com> Date: Thu, 23 Jul 2015 18:51:03 -0700 Subject: [PATCH] Fix thread list iterator --- src/cpp/server/dynamic_thread_pool.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cpp/server/dynamic_thread_pool.cc b/src/cpp/server/dynamic_thread_pool.cc index 7e9b01143a..f58d0420df 100644 --- a/src/cpp/server/dynamic_thread_pool.cc +++ b/src/cpp/server/dynamic_thread_pool.cc @@ -95,9 +95,8 @@ DynamicThreadPool::DynamicThreadPool(int reserve_threads) : } void DynamicThreadPool::ReapThreads(std::list<DynamicThread*>* tlist) { - for (auto t = tlist->begin(); t != tlist->end(); t++) { - delete *t; - t = tlist->erase(t); + for (auto t = tlist->begin(); t != tlist->end(); t = tlist->erase(t)) { + delete *t; } } -- GitLab