From bf8f62c32d6c66e38c167e6ca0ac59d29db52326 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Aug 2014 16:39:04 -0400 Subject: Change Channel::GetModeList to return a copy of the mode list, not a pair of lower/upper bound iterators. Sometimes when iterating the list, like in cs_mode, we can modify the contents of it, which combined with mlock always agressively trying to readd modes to it can do bad things. --- modules/commands/cs_mode.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'modules/commands/cs_mode.cpp') diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 7f22d1e26..d5c356fa4 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -615,15 +615,10 @@ class CommandCSMode : public Command } else { - std::pair its = ci->c->GetModeList(cm->name); - for (; its.first != its.second;) - { - const Anope::string &mask = its.first->second; - ++its.first; - - if (Anope::Match(mask, param)) - ci->c->RemoveMode(NULL, cm, mask); - } + std::vector v = ci->c->GetModeList(cm->name); + for (unsigned j = 0; j < v.size(); ++j) + if (Anope::Match(v[j], param)) + ci->c->RemoveMode(NULL, cm, v[j]); } } } -- cgit