Merge pull request #163 from thefiddler/sdl_guid_crash

[SDL] Workaround for a Mono crash in SDL.JoystickGetGUID
This commit is contained in:
thefiddler 2014-08-09 21:29:34 +02:00
commit 779ff311c2

View file

@ -1527,21 +1527,22 @@ namespace OpenTK.Platform.SDL2
struct JoystickGuid struct JoystickGuid
{ {
unsafe fixed byte data[16]; long data0;
long data1;
public Guid ToGuid() public Guid ToGuid()
{ {
byte[] bytes = new byte[16]; byte[] data = new byte[16];
unsafe unsafe
{ {
fixed (byte* pdata = data) fixed (JoystickGuid* pdata = &this)
{ {
Marshal.Copy(new IntPtr(pdata), bytes, 0, bytes.Length); Marshal.Copy(new IntPtr(pdata), data, 0, data.Length);
} }
} }
return new Guid(bytes); return new Guid(data);
} }
} }