mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09: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:
@ -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");
|
||||
|
Reference in New Issue
Block a user