1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

Fix multiple notifications arriving for imports in edge cases

This commit is contained in:
Dean Herbert 2022-11-02 14:47:56 +09:00
parent 4dabb1aa9c
commit e761c0395d

View File

@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Notifications
} }
} }
private bool completionSent; private int completionSent;
/// <summary> /// <summary>
/// Attempt to post a completion notification. /// Attempt to post a completion notification.
@ -162,11 +162,11 @@ namespace osu.Game.Overlays.Notifications
if (CompletionTarget == null) if (CompletionTarget == null)
return; return;
if (completionSent) // Thread-safe barrier, as this may be called by a web request and also scheduled to the update thread at the same time.
if (Interlocked.Increment(ref completionSent) == 0)
return; return;
CompletionTarget.Invoke(CreateCompletionNotification()); CompletionTarget.Invoke(CreateCompletionNotification());
completionSent = true;
Close(false); Close(false);
} }