Skip to content

Commit

Permalink
Fix GetWritableRegion write-back (#2456)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdkchan authored Jul 10, 2021
1 parent 59900d7 commit b1a9d17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Ryujinx.Memory/IVirtualMemoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ void Fill(ulong va, ulong size, byte value)
{
int copySize = (int)Math.Min(MaxChunkSize, size - subOffset);

GetWritableRegion(va + subOffset, copySize).Memory.Span.Fill(0);
using var writableRegion = GetWritableRegion(va + subOffset, copySize);

writableRegion.Memory.Span.Fill(0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Ryujinx.Memory/MemoryBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public unsafe Memory<byte> GetMemory(ulong offset, int size)
/// <exception cref="InvalidMemoryRegionException">Throw when either <paramref name="offset"/> or <paramref name="size"/> are out of range</exception>
public WritableRegion GetWritableRegion(ulong offset, int size)
{
return new WritableRegion(this, offset, GetMemory(offset, size));
return new WritableRegion(null, offset, GetMemory(offset, size));
}

/// <summary>
Expand Down

0 comments on commit b1a9d17

Please sign in to comment.