Throw ObjectDisposedException from MemoryBlock methods after disposed

This commit is contained in:
YoshiRulz 2021-03-26 14:34:28 +10:00
parent fabf518c73
commit a6f1156012
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 4 additions and 0 deletions

View File

@ -45,8 +45,10 @@ namespace BizHawk.BizInvoke
/// <paramref name="start"/> or end (= <paramref name="start"/> + <paramref name="length"/> - <c>1</c>)
/// are outside [<see cref="Start"/>, <see cref="EndExclusive"/>), the range of the block
/// </exception>
/// <exception cref="ObjectDisposedException">disposed</exception>
public Stream GetStream(ulong start, ulong length, bool writer)
{
if (_pal == null) throw new ObjectDisposedException(nameof(MemoryBlock));
if (start < Start)
throw new ArgumentOutOfRangeException(nameof(start), start, "invalid address");
if (EndExclusive < start + length)
@ -56,8 +58,10 @@ namespace BizHawk.BizInvoke
/// <summary>set r/w/x protection on a portion of memory. rounded to encompassing pages</summary>
/// <exception cref="InvalidOperationException">failed to protect memory</exception>
/// <exception cref="ObjectDisposedException">disposed</exception>
public void Protect(ulong start, ulong length, Protection prot)
{
if (_pal == null) throw new ObjectDisposedException(nameof(MemoryBlock));
if (length == 0)
return;