mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:07:33 +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:
parent
eeb7d359ec
commit
3a37e6e8b1
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -63,11 +64,15 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CancellationTokenSource cancellationTokenSource;
|
||||||
|
|
||||||
private void updateDisplay(APIUser user)
|
private void updateDisplay(APIUser user)
|
||||||
{
|
{
|
||||||
var badges = user.Badges;
|
var badges = user.Badges;
|
||||||
badgeFlowContainer.Clear();
|
badgeFlowContainer.Clear();
|
||||||
|
|
||||||
|
cancellationTokenSource?.Cancel();
|
||||||
|
|
||||||
if (badges?.Length > 0)
|
if (badges?.Length > 0)
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
@ -79,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
// load in stable order regardless of async load order.
|
// load in stable order regardless of async load order.
|
||||||
badgeFlowContainer.Insert(displayIndex, asyncBadge);
|
badgeFlowContainer.Insert(displayIndex, asyncBadge);
|
||||||
});
|
}, (cancellationTokenSource = new CancellationTokenSource()).Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user