1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +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>
/// Attempt to post a completion notification.
@ -162,11 +162,11 @@ namespace osu.Game.Overlays.Notifications
if (CompletionTarget == null)
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;
CompletionTarget.Invoke(CreateCompletionNotification());
completionSent = true;
Close(false);
}