aboutsummaryrefslogtreecommitdiff
path: root/include/cru/common/event.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/common/event.hpp')
-rw-r--r--include/cru/common/event.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/cru/common/event.hpp b/include/cru/common/event.hpp
index 987bcdd6..741dcd99 100644
--- a/include/cru/common/event.hpp
+++ b/include/cru/common/event.hpp
@@ -102,8 +102,9 @@ class Event : public details::EventBase {
template <typename... Args>
void Raise(Args&&... args) {
- for (const auto& handler : handlers_)
- (handler.second)(std::forward<Args>(args)...);
+ std::list<EventHandler> handlers;
+ for (const auto& [key, handler] : handlers_) handlers.push_back(handler);
+ for (const auto& handler : handlers) handler(std::forward<Args>(args)...);
}
protected: