diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs
index 15573f99af..fad8afd371 100644
--- a/osu.Game/Overlays/NotificationOverlay.cs
+++ b/osu.Game/Overlays/NotificationOverlay.cs
@@ -210,14 +210,14 @@ namespace osu.Game.Overlays
mainContent.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
}
- private void notificationClosed()
+ private void notificationClosed() => Schedule(() =>
{
updateCounts();
// this debounce is currently shared between popin/popout sounds, which means one could potentially not play when the user is expecting it.
// popout is constant across all notification types, and should therefore be handled using playback concurrency instead, but seems broken at the moment.
playDebouncedSample("UI/overlay-pop-out");
- }
+ });
private void playDebouncedSample(string sampleName)
{
diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs
index 885bb2fc6c..4e7cebf0ae 100644
--- a/osu.Game/Overlays/Notifications/Notification.cs
+++ b/osu.Game/Overlays/Notifications/Notification.cs
@@ -26,7 +26,8 @@ namespace osu.Game.Overlays.Notifications
public abstract class Notification : Container
{
///
- /// User requested close.
+ /// Notification was closed, either by user or otherwise.
+ /// Importantly, this event may be fired from a non-update thread.
///
public event Action? Closed;
@@ -55,6 +56,8 @@ namespace osu.Game.Overlays.Notifications
protected Container IconContent;
+ public bool WasClosed { get; private set; }
+
private readonly Container content;
protected override Container Content => content;
@@ -245,21 +248,23 @@ namespace osu.Game.Overlays.Notifications
initialFlash.FadeOutFromOne(2000, Easing.OutQuart);
}
- public bool WasClosed;
-
public virtual void Close(bool runFlingAnimation)
{
if (WasClosed) return;
WasClosed = true;
- if (runFlingAnimation && dragContainer.FlingLeft())
- this.FadeOut(600, Easing.In);
- else
- this.FadeOut(100);
-
Closed?.Invoke();
- Expire();
+
+ Schedule(() =>
+ {
+ if (runFlingAnimation && dragContainer.FlingLeft())
+ this.FadeOut(600, Easing.In);
+ else
+ this.FadeOut(100);
+
+ Expire();
+ });
}
private class DragContainer : Container
diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs
index c4d402e5b9..58c9814781 100644
--- a/osu.Game/Overlays/Notifications/ProgressNotification.cs
+++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs
@@ -141,8 +141,6 @@ namespace osu.Game.Overlays.Notifications
case ProgressNotificationState.Completed:
loadingSpinner.Hide();
- attemptPostCompletion();
- base.Close(false);
break;
}
}
@@ -166,6 +164,8 @@ namespace osu.Game.Overlays.Notifications
CompletionTarget.Invoke(CreateCompletionNotification());
completionSent = true;
+
+ Close(false);
}
private ProgressNotificationState state;
@@ -239,6 +239,7 @@ namespace osu.Game.Overlays.Notifications
{
switch (State)
{
+ case ProgressNotificationState.Completed:
case ProgressNotificationState.Cancelled:
base.Close(runFlingAnimation);
break;