mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:45:09 +08:00
Use ObjectDisposedException.ThrowIf throw helper
This commit is contained in:
parent
e935c49a98
commit
43841e210d
@ -489,8 +489,7 @@ 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)
|
ObjectDisposedException.ThrowIf(isDisposed, this);
|
||||||
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.
|
||||||
@ -675,8 +674,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
private Realm getRealmInstance()
|
private Realm getRealmInstance()
|
||||||
{
|
{
|
||||||
if (isDisposed)
|
ObjectDisposedException.ThrowIf(isDisposed, this);
|
||||||
throw new ObjectDisposedException(nameof(RealmAccess));
|
|
||||||
|
|
||||||
bool tookSemaphoreLock = false;
|
bool tookSemaphoreLock = false;
|
||||||
|
|
||||||
@ -1189,8 +1187,7 @@ namespace osu.Game.Database
|
|||||||
if (!ThreadSafety.IsUpdateThread)
|
if (!ThreadSafety.IsUpdateThread)
|
||||||
throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread.");
|
throw new InvalidOperationException(@$"{nameof(BlockAllOperations)} must be called from the update thread.");
|
||||||
|
|
||||||
if (isDisposed)
|
ObjectDisposedException.ThrowIf(isDisposed, this);
|
||||||
throw new ObjectDisposedException(nameof(RealmAccess));
|
|
||||||
|
|
||||||
SynchronizationContext? syncContext = null;
|
SynchronizationContext? syncContext = null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user