diff --git a/src/js_realm.hpp b/src/js_realm.hpp index a670224c..456abf87 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -120,7 +120,8 @@ class RealmDelegate : public BindingContext { arguments[0] = realm_object; arguments[1] = Value::from_string(m_context, notification_name); - for (auto &callback : m_notifications) { + std::list> notifications_copy(m_notifications); + for (auto &callback : notifications_copy) { Function::call(m_context, callback, realm_object, 2, arguments); } }