sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.68k stars 642 forks source link

Remove Marshal.FreeHGlobal over ConePointer to avoid native exception #1092

Closed vicfergar closed 5 years ago

vicfergar commented 5 years ago

When X3dAudio.Calculate method is invoked for an emitter with a non-null Cone, an exception is raised indicating an invalid memory access.

To solve this, I have removed the Marshal.FreeHGlobal(ConePointer) invocation from the Emitter.Native.MarshalFree() method. That causes the exception, seeing that this structure is always allocated in the stack and no memory is allocated using Marshal.AllocHGlobal.

xoofx commented 5 years ago

Good catch, thanks!