1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 19:05:37 +08:00

Throw immediately if attempting to WriteAsync after disposed

This commit is contained in:
Dean Herbert 2022-06-27 19:34:28 +09:00
parent c39c99bd43
commit 83982d258d

View File

@ -396,6 +396,9 @@ namespace osu.Game.Database
/// <param name="action">The work to run.</param> /// <param name="action">The work to run.</param>
public Task WriteAsync(Action<Realm> action) public Task WriteAsync(Action<Realm> action)
{ {
if (isDisposed)
throw new ObjectDisposedException(nameof(RealmAccess));
// Required to ensure the write is tracked and accounted for before disposal. // Required to ensure the write is tracked and accounted for before disposal.
// Can potentially be avoided if we have a need to do so in the future. // Can potentially be avoided if we have a need to do so in the future.
if (!ThreadSafety.IsUpdateThread) if (!ThreadSafety.IsUpdateThread)