1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-26 18:30:23 +08:00

Ensure notification posts are always scheduled to local thread

Posts can be triggered by Logger.Log events which are not guaranteed to be on the update thread.
This commit is contained in:
Dean Herbert
2017-07-28 15:03:08 +09:00
Unverified
parent f705589bf2
commit 02a04afb29
+11 -8
View File
@@ -72,17 +72,20 @@ namespace osu.Game.Overlays
public void Post(Notification notification)
{
State = Visibility.Visible;
Schedule(() =>
{
State = Visibility.Visible;
++runningDepth;
notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;
++runningDepth;
notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;
var hasCompletionTarget = notification as IHasCompletionTarget;
if (hasCompletionTarget != null)
hasCompletionTarget.CompletionTarget = Post;
var hasCompletionTarget = notification as IHasCompletionTarget;
if (hasCompletionTarget != null)
hasCompletionTarget.CompletionTarget = Post;
var ourType = notification.GetType();
sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification);
var ourType = notification.GetType();
sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification);
});
}
protected override void PopIn()