mirror of https://github.com/ppy/osu
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:
parent
f705589bf2
commit
02a04afb29
|
@ -72,17 +72,20 @@ private void load()
|
|||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue