From 9ba99ed57d0abc9e67ee9bbab633077a7103976c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Apr 2022 14:42:54 +0900 Subject: [PATCH] Ensure all access to `MultiplayerClient.Room` is on the update thread This was an implicit requirement until now, but not well documented everywhere. Adding this makes it much easier to understand the requirement (and probably safer). --- .../Online/Multiplayer/MultiplayerClient.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index d6099e5f72..2084ba048d 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Development; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Database; @@ -87,7 +88,21 @@ namespace osu.Game.Online.Multiplayer /// /// The joined . /// - public MultiplayerRoom? Room { get; private set; } + public MultiplayerRoom? Room + { + get + { + Debug.Assert(ThreadSafety.IsUpdateThread); + return room; + } + private set + { + Debug.Assert(ThreadSafety.IsUpdateThread); + room = value; + } + } + + private MultiplayerRoom? room; /// /// The users in the joined which are participating in the current gameplay loop.