1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge pull request #21071 from peppy/fix-multiple-import-notifications

Fix multiple notifications arriving for imports in edge cases
This commit is contained in:
Dan Balasescu 2022-11-02 16:54:56 +09:00 committed by GitHub
commit cb51fc7384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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.Exchange(ref completionSent, 1) == 1)
return;
CompletionTarget.Invoke(CreateCompletionNotification());
completionSent = true;
Close(false);
}