# # # patch "ChangeLog" # from [0f1404eed1dce6df48cdab5de2a21349a6f66e31] # to [13819986e3896f0a5ea4cb42d7c7c712b84b37b0] # # patch "contrib/usher.cc" # from [cb295e80eb1af0bd7d55cde7da973c340a05deb2] # to [599b754c575694458973cf7ecd5be5fd5a03c06d] # ============================================================ --- ChangeLog 0f1404eed1dce6df48cdab5de2a21349a6f66e31 +++ ChangeLog 13819986e3896f0a5ea4cb42d7c7c712b84b37b0 @@ -1,3 +1,10 @@ +2006-02-21 Richard Levitte + + * contrib/usher.cc (server::set_hosts): Erasing the list node that + we're iterating on, then trying to go to the next node doesn't + work. Save the iterator, then increment it before erasing the + node using the saved value. No more segfaults. + 2006-02-20 Richard Levitte * monotone.cc (cpp_main), options.hh, ui.cc (redirect_log_to), ============================================================ --- contrib/usher.cc cb295e80eb1af0bd7d55cde7da973c340a05deb2 +++ contrib/usher.cc 599b754c575694458973cf7ecd5be5fd5a03c06d @@ -1,3 +1,4 @@ +// -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- // Timothy Brownawell // GPL v2 // @@ -691,10 +692,16 @@ c = servers_by_host.find(*i); if (c != servers_by_host.end()) { list >::iterator>::iterator j; - for (j = c->second->by_host.begin(); j != c->second->by_host.end(); ++j) - if ((*j)->first == *i) { - servers_by_host.erase(*j); - c->second->by_host.erase(j); + for (j = c->second->by_host.begin(); j != c->second->by_host.end();) + { + list >::iterator>::iterator j_saved + = j; + ++j; + if ((*j_saved)->first == *i) + { + servers_by_host.erase(*j_saved); + c->second->by_host.erase(j_saved); + } } } c = servers_by_host.insert(make_pair(*i, me)).first;