diff --git a/Ryujinx.Memory/IVirtualMemoryManager.cs b/Ryujinx.Memory/IVirtualMemoryManager.cs index b5e08019..056940cc 100644 --- a/Ryujinx.Memory/IVirtualMemoryManager.cs +++ b/Ryujinx.Memory/IVirtualMemoryManager.cs @@ -66,7 +66,9 @@ namespace Ryujinx.Memory { 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); } } diff --git a/Ryujinx.Memory/MemoryBlock.cs b/Ryujinx.Memory/MemoryBlock.cs index e331a453..25c66dfe 100644 --- a/Ryujinx.Memory/MemoryBlock.cs +++ b/Ryujinx.Memory/MemoryBlock.cs @@ -333,7 +333,7 @@ namespace Ryujinx.Memory /// Throw when either or are out of range public WritableRegion GetWritableRegion(ulong offset, int size) { - return new WritableRegion(this, offset, GetMemory(offset, size)); + return new WritableRegion(null, offset, GetMemory(offset, size)); } ///