Fix EndPlaying potentially doing cross-thread mutation

This commit is contained in:
smoogipoo 2021-05-21 15:57:39 +09:00
parent 2fdf8aa1aa
commit 7f712a4d04

View File

@ -167,10 +167,15 @@ namespace osu.Game.Online.Spectator
public void EndPlaying() public void EndPlaying()
{ {
IsPlaying = false; // This method is most commonly called via Dispose(), which is asynchronous.
currentBeatmap = null; // Todo: This should not be a thing, but requires framework changes.
Schedule(() =>
{
IsPlaying = false;
currentBeatmap = null;
EndPlayingInternal(currentState); EndPlayingInternal(currentState);
});
} }
public void WatchUser(int userId) public void WatchUser(int userId)