mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:53:23 +08:00
Don't dispose fetched realm instance when using RealmLive.Value
See https://github.com/realm/realm-dotnet/discussions/2734#discussioncomment-1705038 for reasoning.
This commit is contained in:
parent
1dd5e1ca89
commit
348d1d0be9
@ -100,10 +100,11 @@ namespace osu.Game.Database
|
||||
if (originalDataValid)
|
||||
return data;
|
||||
|
||||
T retrieved;
|
||||
if (!isCorrectThread)
|
||||
throw new InvalidOperationException($"Can't use {nameof(Value)} unless on the same thread the original data was fetched from.");
|
||||
|
||||
using (var realm = Realm.GetInstance(data.Realm.Config))
|
||||
retrieved = realm.Find<T>(ID);
|
||||
var realm = Realm.GetInstance(data.Realm.Config);
|
||||
var retrieved = realm.Find<T>(ID);
|
||||
|
||||
if (!retrieved.IsValid)
|
||||
throw new InvalidOperationException("Attempted to access value without an open context");
|
||||
|
Loading…
Reference in New Issue
Block a user