From 2baf442f9207326b1a60bd91742a2f82aaef293e Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Thu, 1 Sep 2016 10:40:37 -0400 Subject: [PATCH] Erase element from map after manipulating. After map.erase, iterator is invalidated. Signed-off-by: J. Eric Ivancich --- src/dmclock_server.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dmclock_server.h b/src/dmclock_server.h index b0a25fe..197f852 100644 --- a/src/dmclock_server.h +++ b/src/dmclock_server.h @@ -997,8 +997,8 @@ namespace crimson { for (auto i = client_map.begin(); i != client_map.end(); /* empty */) { auto i2 = i++; if (erase_point && i2->second->last_tick <= erase_point) { - client_map.erase(i2); delete_from_heaps(i2->second); + client_map.erase(i2); } else if (idle_point && i2->second->last_tick <= idle_point) { i2->second->idle = true; }