Fix a problem with iface::cleanup() where 'it' was incremented improperly

This commit is contained in:
Daniel Adolfsson 2012-02-07 22:28:53 +01:00
parent 0dbc3e288a
commit b3e45caf20
3 changed files with 10 additions and 7 deletions

View File

@ -492,9 +492,10 @@ void iface::add_session(const ptr<session>& se)
void iface::cleanup()
{
for (std::map<std::string, weak_ptr<iface> >::iterator it = _map.begin();
it != _map.end(); it++) {
if (!it->second) {
_map.erase(it);
it != _map.end(); ) {
std::map<std::string, weak_ptr<iface> >::iterator c_it = it++;
if (!c_it->second) {
_map.erase(c_it);
}
}
}

View File

@ -83,6 +83,8 @@ void route::load(const std::string& path)
{
_routes.clear();
logger::debug() << "reading routes";
try {
std::ifstream ifs;
ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit);