Browse Source

Ensure nothing is preserved if previously allocated

Former-commit-id: d83f70acf8d55f37023f84aa46b5918db3b44477
Former-commit-id: aa82f2434e299dfdc5da233d2134e40f5cba563e
Former-commit-id: 501d485d858549d12cd406fe855e18a9a00c3282
af/merge-core
James Jackson-South 10 years ago
parent
commit
a0168a6709
  1. 8
      src/ImageProcessorCore/ImageBase.cs

8
src/ImageProcessorCore/ImageBase.cs

@ -191,6 +191,14 @@ namespace ImageProcessorCore
this.Width = width;
this.Height = height;
// Ensure nothing is preserved if previously allocated.
if (this.pixelsHandle.IsAllocated)
{
this.pixelsArray = null;
this.pixelsHandle.Free();
this.pixelsBase = null;
}
this.pixelsArray = pixels;
this.pixelsHandle = GCHandle.Alloc(this.pixelsArray, GCHandleType.Pinned);
this.pixelsBase = (float*)this.pixelsHandle.AddrOfPinnedObject().ToPointer();

Loading…
Cancel
Save