From d30150aca7deb58216b775cea423d0378123b062 Mon Sep 17 00:00:00 2001 From: dP Date: Fri, 10 Jul 2020 01:22:16 +0300 Subject: [PATCH] Fix event handlers --- src/citymania/cm_event.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/citymania/cm_event.hpp b/src/citymania/cm_event.hpp index 4c0bde4fdd..54d66b9c4b 100644 --- a/src/citymania/cm_event.hpp +++ b/src/citymania/cm_event.hpp @@ -130,6 +130,7 @@ public: void listen(Slot slot, Handler &handler) { this->handler_map.insert(std::make_pair(slot, handler)); + this->new_handlers = true; } void emit(const T &event) { @@ -138,6 +139,7 @@ public: for (auto &p : this->handler_map) { this->handlers.push_back(p.second); } + this->new_handlers = false; } for (auto &h : this->handlers) { h(event);