Fix threading failure

Implicitly showing the medal overlay fires off some transforms, and the
websocket listener runs on a TPL thread. That's a recipe for disaster,
so schedule the show call.
This commit is contained in:
Bartłomiej Dach 2024-02-20 15:02:30 +01:00
parent 8abcc70b93
commit 96825915f7
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,8 @@ public partial class MedalOverlay : OsuFocusedOverlayContainer
protected override string? PopInSampleName => null;
protected override string? PopOutSampleName => null;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
protected override void PopIn() => this.FadeIn();
protected override void PopOut() => this.FadeOut();
@ -52,7 +54,7 @@ protected override void LoadComplete()
OverlayActivationMode.BindValueChanged(val =>
{
if (val.NewValue != OverlayActivation.Disabled && queuedMedals.Any())
if (val.NewValue != OverlayActivation.Disabled && (queuedMedals.Any() || medalContainer.Any()))
Show();
}, true);
}
@ -79,7 +81,7 @@ private void handleMedalMessages(SocketMessage obj)
var medalAnimation = new MedalAnimation(medal);
queuedMedals.Enqueue(medalAnimation);
Show();
Scheduler.AddOnce(Show);
}
protected override void Update()