aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ryujinx.Memory/Tracking/RegionHandle.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Ryujinx.Memory/Tracking/RegionHandle.cs b/Ryujinx.Memory/Tracking/RegionHandle.cs
index b30dcbc2..14c6de2c 100644
--- a/Ryujinx.Memory/Tracking/RegionHandle.cs
+++ b/Ryujinx.Memory/Tracking/RegionHandle.cs
@@ -144,9 +144,11 @@ namespace Ryujinx.Memory.Tracking
{
lock (_preActionLock)
{
- RegionSignal action = Interlocked.Exchange(ref _preAction, null);
+ _preAction?.Invoke(address, size);
- action?.Invoke(address, size);
+ // The action is removed after it returns, to ensure that the null check above succeeds when
+ // it's still in progress rather than continuing and possibly missing a required data flush.
+ Interlocked.Exchange(ref _preAction, null);
}
}
finally