Add locking over realmSubscriptionsResetMap for sanity

This commit is contained in:
Dean Herbert 2022-01-24 13:36:51 +09:00
parent 351c766ea1
commit 997c13f643

View File

@ -243,9 +243,11 @@ namespace osu.Game.Database
if (!ThreadSafety.IsUpdateThread)
throw new InvalidOperationException(@$"{nameof(Register)} must be called from the update thread.");
realmSubscriptionsResetMap.Add(action, () => onChanged(new EmptyRealmSet<T>(), null, null));
return Register(action);
lock (contextLock)
{
realmSubscriptionsResetMap.Add(action, () => onChanged(new EmptyRealmSet<T>(), null, null));
return Register(action);
}
IDisposable? action(Realm realm) => query(realm).QueryAsyncWithNotifications(onChanged);
}