mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 12:58:01 +09:00
Merge pull request #15855 from peppy/live-post-construction-attach
Fix `RealmLive` not working if data is attached to realm post-`ToLive` call
This commit is contained in:
commit
e2cb420c06
@ -29,6 +29,22 @@ namespace osu.Game.Tests.Database
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAccessAfterAttach()
|
||||||
|
{
|
||||||
|
RunTestWithRealm((realmFactory, _) =>
|
||||||
|
{
|
||||||
|
var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||||
|
|
||||||
|
var liveBeatmap = beatmap.ToLive();
|
||||||
|
|
||||||
|
using (var context = realmFactory.CreateContext())
|
||||||
|
context.Write(r => r.Add(beatmap));
|
||||||
|
|
||||||
|
Assert.IsFalse(liveBeatmap.PerformRead(l => l.Hidden));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAccessNonManaged()
|
public void TestAccessNonManaged()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
public Guid ID { get; }
|
public Guid ID { get; }
|
||||||
|
|
||||||
public bool IsManaged { get; }
|
public bool IsManaged => data.IsManaged;
|
||||||
|
|
||||||
private readonly SynchronizationContext? fetchedContext;
|
private readonly SynchronizationContext? fetchedContext;
|
||||||
private readonly int fetchedThreadId;
|
private readonly int fetchedThreadId;
|
||||||
@ -37,8 +37,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
if (data.IsManaged)
|
if (data.IsManaged)
|
||||||
{
|
{
|
||||||
IsManaged = true;
|
|
||||||
|
|
||||||
fetchedContext = SynchronizationContext.Current;
|
fetchedContext = SynchronizationContext.Current;
|
||||||
fetchedThreadId = Thread.CurrentThread.ManagedThreadId;
|
fetchedThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user