fix bug: unsubscribe while notif

This commit is contained in:
2026-01-11 23:24:27 +00:00
parent 411d49bb7c
commit d2ef352ce9
@@ -39,7 +39,10 @@ class Subscribable {
return; return;
} }
for (auto& subscriber : entry->second) { // edge case: if a subscriber unsubscribes itself during notification
// this modifies the vector and makes my iterators invalid
auto subscribersCopy = entry->second;
for (auto& subscriber : subscribersCopy) {
subscriber->onNotification(eventId, eventInfo); subscriber->onNotification(eventId, eventInfo);
} }
} }