From b93d650b1f63a0159a88404bd64f79311700b11d Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 7 Aug 2013 21:14:05 +0000 Subject: [PATCH] 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 7f1b5552dc4ddccb688120d66946601fa695b650. --- include/modules.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/modules.h b/include/modules.h index aef6d7d30..14661d1c7 100644 --- a/include/modules.h +++ b/include/modules.h @@ -63,7 +63,6 @@ if (true) \ { \ static std::vector &_modules = ModuleManager::GetEventHandlers(#ename); \ - bool _shrink = false; \ for (std::vector::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(_modules).swap(_modules); \ } \ else \ static_cast(0) @@ -101,7 +97,6 @@ if (true) \ { \ ret = EVENT_CONTINUE; \ static std::vector &_modules = ModuleManager::GetEventHandlers(#ename); \ - bool _shrink = false; \ for (std::vector::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(_modules).swap(_modules); \ } \ else \ static_cast(0)