diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs
index 42133160ca..66bd22df52 100644
--- a/osu.Game/Online/API/APIAccess.cs
+++ b/osu.Game/Online/API/APIAccess.cs
@@ -142,10 +142,10 @@ namespace osu.Game.Online.API
// Show a placeholder user if saved credentials are available.
// This is useful for storing local scores and showing a placeholder username after starting the game,
// until a valid connection has been established.
- localUser.Value = new APIUser
+ setLocalUser(new APIUser
{
Username = ProvidedUsername,
- };
+ });
}
// save the username at this point, if the user requested for it to be.
@@ -188,12 +188,12 @@ namespace osu.Game.Online.API
else
failConnectionProcess();
};
- userReq.Success += u =>
+ userReq.Success += user =>
{
- localUser.Value = u;
-
// todo: save/pull from settings
- localUser.Value.Status.Value = new UserStatusOnline();
+ user.Status.Value = new UserStatusOnline();
+
+ setLocalUser(user);
failureCount = 0;
};
@@ -453,7 +453,7 @@ namespace osu.Game.Online.API
// Scheduled prior to state change such that the state changed event is invoked with the correct user and their friends present
Schedule(() =>
{
- localUser.Value = createGuestUser();
+ setLocalUser(createGuestUser());
friends.Clear();
});
@@ -463,6 +463,8 @@ namespace osu.Game.Online.API
private static APIUser createGuestUser() => new GuestUser();
+ private void setLocalUser(APIUser user) => Scheduler.Add(() => localUser.Value = user, false);
+
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs
index 812aa7f09f..a90b11e354 100644
--- a/osu.Game/Online/API/IAPIProvider.cs
+++ b/osu.Game/Online/API/IAPIProvider.cs
@@ -13,19 +13,16 @@ namespace osu.Game.Online.API
{
///
/// The local user.
- /// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
///
IBindable LocalUser { get; }
///
/// The user's friends.
- /// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
///
IBindableList Friends { get; }
///
/// The current user's activity.
- /// This is not thread-safe and should be scheduled locally if consumed from a drawable component.
///
IBindable Activity { get; }