1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Merge pull request #17724 from peppy/fix-disconnect-assert-issue

Fix potential assert failure due to `Room` access from disconnection event
This commit is contained in:
Dan Balasescu 2022-04-08 19:44:20 +09:00 committed by GitHub
commit e6e475118f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,7 +142,7 @@ namespace osu.Game.Online.Multiplayer
[BackgroundDependencyLoader]
private void load()
{
IsConnected.BindValueChanged(connected =>
IsConnected.BindValueChanged(connected => Scheduler.Add(() =>
{
// clean up local room state on server disconnect.
if (!connected.NewValue && Room != null)
@ -150,7 +150,7 @@ namespace osu.Game.Online.Multiplayer
Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important);
LeaveRoom();
}
});
}));
}
private readonly TaskChain joinOrLeaveTaskChain = new TaskChain();