1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Fix dangerous realm operation in TestSceneMultiplayerMatchSongSelect

The import process was running on the async load thread, but then
accessed from the access thread later on. This seemed to somehow pass
fine in headless runs, but would fail on visual test execution
(specifically on `TestBeatmapConfirmed()`).
This commit is contained in:
Dean Herbert 2022-04-06 14:01:25 +09:00
parent 6b0392f990
commit 220d7bc6db

View File

@ -15,6 +15,7 @@ using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.Rooms;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets;
@ -35,10 +36,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
private BeatmapManager manager;
private RulesetStore rulesets;
private List<BeatmapInfo> beatmaps;
private IList<BeatmapInfo> beatmaps => importedBeatmapSet?.PerformRead(s => s.Beatmaps) ?? new List<BeatmapInfo>();
private TestMultiplayerMatchSongSelect songSelect;
private Live<BeatmapSetInfo> importedBeatmapSet;
[BackgroundDependencyLoader]
private void load(GameHost host, AudioManager audio)
{
@ -46,8 +49,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default));
Dependencies.Cache(Realm);
beatmaps = new List<BeatmapInfo>();
var metadata = new BeatmapMetadata
{
Artist = "Some Artist",
@ -79,11 +80,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
Difficulty = new BeatmapDifficulty()
};
beatmaps.Add(beatmap);
beatmapSetInfo.Beatmaps.Add(beatmap);
}
manager.Import(beatmapSetInfo);
importedBeatmapSet = manager.Import(beatmapSetInfo);
}
public override void SetUpSteps()