From c4d4107412554bd0bdebb1285ff4a8c5613175f4 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 19 Dec 2013 07:31:49 -0500 Subject: [PATCH] Channel::Sync can delete the channel, so safely iterate them when syncing from a server burst --- src/servers.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/servers.cpp b/src/servers.cpp index 46e1a7077..e70ce8641 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -269,9 +269,11 @@ void Server::Sync(bool sync_links) FOREACH_MOD(OnPreUplinkSync, (this)); } - for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) + for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;) { Channel *c = it->second; + ++it; + if (c->syncing) c->Sync(); }