Skip to content

Commit 289e9f8

Browse files
committed
pass only "pinnable: this" to MemoryHandle
1 parent f4a3a0e commit 289e9f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public override unsafe MemoryHandle Pin(int elementIndex = 0)
2424
}
2525

2626
void* ptr = (void*)this.pinHandle.AddrOfPinnedObject();
27-
return new MemoryHandle(ptr, this.pinHandle, this);
27+
28+
// We should only pass pinnable:this, when GCHandle lifetime is managed by the MemoryManager<T> instance.
29+
return new MemoryHandle(ptr, pinnable: this);
2830
}
2931

3032
/// <inheritdoc />

0 commit comments

Comments
 (0)