Skip to content

Commit

Permalink
Erase element from map after manipulating. After map.erase, iterator
Browse files Browse the repository at this point in the history
is invalidated.

Signed-off-by: J. Eric Ivancich <[email protected]>
  • Loading branch information
ivancich committed Sep 6, 2016
1 parent 5381dc0 commit 2baf442
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dmclock_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2baf442

Please sign in to comment.