mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:58:21 +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
e40e5096ea
commit
cb8fa80352
@ -102,10 +102,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