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

Fix profile badges potentially showing on incorrect profile when switching users

Closes https://github.com/ppy/osu/issues/17081.
This commit is contained in:
Dean Herbert 2022-03-04 12:00:02 +09:00
parent eeb7d359ec
commit 3a37e6e8b1

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
@ -63,11 +64,15 @@ namespace osu.Game.Overlays.Profile.Header
};
}
private CancellationTokenSource cancellationTokenSource;
private void updateDisplay(APIUser user)
{
var badges = user.Badges;
badgeFlowContainer.Clear();
cancellationTokenSource?.Cancel();
if (badges?.Length > 0)
{
Show();
@ -79,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Header
{
// load in stable order regardless of async load order.
badgeFlowContainer.Insert(displayIndex, asyncBadge);
});
}, (cancellationTokenSource = new CancellationTokenSource()).Token);
}
}
else