Throw ObjectDisposedException from MemoryBlock methods after disposed
This commit is contained in:
parent
fabf518c73
commit
a6f1156012
|
@ -45,8 +45,10 @@ namespace BizHawk.BizInvoke
|
||||||
/// <paramref name="start"/> or end (= <paramref name="start"/> + <paramref name="length"/> - <c>1</c>)
|
/// <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
|
/// are outside [<see cref="Start"/>, <see cref="EndExclusive"/>), the range of the block
|
||||||
/// </exception>
|
/// </exception>
|
||||||
|
/// <exception cref="ObjectDisposedException">disposed</exception>
|
||||||
public Stream GetStream(ulong start, ulong length, bool writer)
|
public Stream GetStream(ulong start, ulong length, bool writer)
|
||||||
{
|
{
|
||||||
|
if (_pal == null) throw new ObjectDisposedException(nameof(MemoryBlock));
|
||||||
if (start < Start)
|
if (start < Start)
|
||||||
throw new ArgumentOutOfRangeException(nameof(start), start, "invalid address");
|
throw new ArgumentOutOfRangeException(nameof(start), start, "invalid address");
|
||||||
if (EndExclusive < start + length)
|
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>
|
/// <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="InvalidOperationException">failed to protect memory</exception>
|
||||||
|
/// <exception cref="ObjectDisposedException">disposed</exception>
|
||||||
public void Protect(ulong start, ulong length, Protection prot)
|
public void Protect(ulong start, ulong length, Protection prot)
|
||||||
{
|
{
|
||||||
|
if (_pal == null) throw new ObjectDisposedException(nameof(MemoryBlock));
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue