mirror of
https://github.com/anope/anope.git
synced 2026-07-10 19:03:13 +02:00
Revert "Shrink to fit module event vectors when modules are removed from them"
Sometimes the events call the function the event is in, which causes a resize
while the original function is iterating.
This reverts commit 7f1b5552dc.
This commit is contained in:
@@ -63,7 +63,6 @@
|
||||
if (true) \
|
||||
{ \
|
||||
static std::vector<Module *> &_modules = ModuleManager::GetEventHandlers(#ename); \
|
||||
bool _shrink = false; \
|
||||
for (std::vector<Module *>::iterator _i = _modules.begin(); _i != _modules.end();) \
|
||||
{ \
|
||||
try \
|
||||
@@ -77,13 +76,10 @@ if (true) \
|
||||
catch (const NotImplementedException &) \
|
||||
{ \
|
||||
_i = _modules.erase(_i); \
|
||||
_shrink = true; \
|
||||
continue; \
|
||||
} \
|
||||
++_i; \
|
||||
} \
|
||||
if (_shrink) \
|
||||
std::vector<Module *>(_modules).swap(_modules); \
|
||||
} \
|
||||
else \
|
||||
static_cast<void>(0)
|
||||
@@ -101,7 +97,6 @@ if (true) \
|
||||
{ \
|
||||
ret = EVENT_CONTINUE; \
|
||||
static std::vector<Module *> &_modules = ModuleManager::GetEventHandlers(#ename); \
|
||||
bool _shrink = false; \
|
||||
for (std::vector<Module *>::iterator _i = _modules.begin(); _i != _modules.end();) \
|
||||
{ \
|
||||
try \
|
||||
@@ -120,13 +115,10 @@ if (true) \
|
||||
catch (const NotImplementedException &) \
|
||||
{ \
|
||||
_i = _modules.erase(_i); \
|
||||
_shrink = true; \
|
||||
continue; \
|
||||
} \
|
||||
++_i; \
|
||||
} \
|
||||
if (_shrink) \
|
||||
std::vector<Module *>(_modules).swap(_modules); \
|
||||
} \
|
||||
else \
|
||||
static_cast<void>(0)
|
||||
|
||||
Reference in New Issue
Block a user