mirror of https://github.com/ppy/osu
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:
parent
8abcc70b93
commit
96825915f7
|
@ -22,6 +22,8 @@ public partial class MedalOverlay : OsuFocusedOverlayContainer
|
||||||
protected override string? PopInSampleName => null;
|
protected override string? PopInSampleName => null;
|
||||||
protected override string? PopOutSampleName => null;
|
protected override string? PopOutSampleName => null;
|
||||||
|
|
||||||
|
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
|
||||||
|
|
||||||
protected override void PopIn() => this.FadeIn();
|
protected override void PopIn() => this.FadeIn();
|
||||||
|
|
||||||
protected override void PopOut() => this.FadeOut();
|
protected override void PopOut() => this.FadeOut();
|
||||||
|
@ -52,7 +54,7 @@ protected override void LoadComplete()
|
||||||
|
|
||||||
OverlayActivationMode.BindValueChanged(val =>
|
OverlayActivationMode.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
if (val.NewValue != OverlayActivation.Disabled && queuedMedals.Any())
|
if (val.NewValue != OverlayActivation.Disabled && (queuedMedals.Any() || medalContainer.Any()))
|
||||||
Show();
|
Show();
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +81,7 @@ private void handleMedalMessages(SocketMessage obj)
|
||||||
|
|
||||||
var medalAnimation = new MedalAnimation(medal);
|
var medalAnimation = new MedalAnimation(medal);
|
||||||
queuedMedals.Enqueue(medalAnimation);
|
queuedMedals.Enqueue(medalAnimation);
|
||||||
Show();
|
Scheduler.AddOnce(Show);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
|
Loading…
Reference in New Issue