Fix of memory leak

This commit is contained in:
Vlad K 2017-05-09 05:36:54 +03:00
parent e792bd80fe
commit 18dd603696
2 changed files with 6 additions and 1 deletions

View file

@ -139,6 +139,10 @@ namespace OpenTK.Platform.SDL2
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_FreeSurface", ExactSpelling = true)]
public static extern void FreeSurface(IntPtr surface);
[SuppressUnmanagedCodeSecurity]
[DllImport (lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_free", ExactSpelling = true)]
public static extern void Free (IntPtr memblock);
#region GameContoller
[SuppressUnmanagedCodeSecurity]

View file

@ -201,6 +201,7 @@ namespace OpenTK.Platform.SDL2
if (windows.TryGetValue(ev.Drop.WindowID, out window))
{
ProcessDropEvent(window, ev.Drop);
SDL.Free(ev.Drop.File);
processed = true;
}
break;
@ -311,7 +312,7 @@ namespace OpenTK.Platform.SDL2
byte [] byteArray = new byte[length];
Marshal.Copy(ev.File, byteArray, 0, length);
string dropString = System.Text.Encoding.UTF8.GetString (byteArray);
string dropString = System.Text.Encoding.UTF8.GetString(byteArray);
window.OnDrop(dropString);
}