Fix of memory leak
This commit is contained in:
parent
e792bd80fe
commit
18dd603696
2 changed files with 6 additions and 1 deletions
|
@ -139,6 +139,10 @@ namespace OpenTK.Platform.SDL2
|
||||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_FreeSurface", ExactSpelling = true)]
|
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_FreeSurface", ExactSpelling = true)]
|
||||||
public static extern void FreeSurface(IntPtr surface);
|
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
|
#region GameContoller
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
|
|
@ -201,6 +201,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
if (windows.TryGetValue(ev.Drop.WindowID, out window))
|
if (windows.TryGetValue(ev.Drop.WindowID, out window))
|
||||||
{
|
{
|
||||||
ProcessDropEvent(window, ev.Drop);
|
ProcessDropEvent(window, ev.Drop);
|
||||||
|
SDL.Free(ev.Drop.File);
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -311,7 +312,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
|
|
||||||
byte [] byteArray = new byte[length];
|
byte [] byteArray = new byte[length];
|
||||||
Marshal.Copy(ev.File, byteArray, 0, 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);
|
window.OnDrop(dropString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue