fix potentially modifying event listeners set while iterating

This commit is contained in:
camila314 2023-02-07 13:58:21 -06:00
parent df00ad7b88
commit 1f7d50a9b9

View file

@ -19,7 +19,9 @@ Event::~Event() {}
void Event::postFrom(Mod* m) {
if (m) this->sender = m;
for (auto h : Event::listeners()) {
std::unordered_set<EventListenerProtocol*> listeners_copy = Event::listeners();
for (auto h : listeners_copy) {
if (h->passThrough(this) == ListenerResult::Stop) {
break;
}