mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 01:45:35 -05:00
fix potentially modifying event listeners set while iterating
This commit is contained in:
parent
df00ad7b88
commit
1f7d50a9b9
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue