Permalink
Browse files

[SDL][Win] Destroy custom cursor on Close()

X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.
  • Loading branch information...
1 parent c8c0d32 commit 9988a2ba9c75d0db66a8426be6b8f47202ea4ce0 @thefiddler thefiddler committed May 1, 2014
Showing with 12 additions and 0 deletions.
  1. +6 −0 Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
  2. +6 −0 Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -1057,6 +1057,12 @@ void Dispose(bool manual)
{
DestroyWindow();
}
+
+ if (sdl_cursor != IntPtr.Zero)
+ {
+ SDL.FreeCursor(sdl_cursor);
+ sdl_cursor = IntPtr.Zero;
+ }
}
else
{
@@ -1639,6 +1639,12 @@ void Dispose(bool calledManually)
{
if (calledManually)
{
+ if (Cursor != MouseCursor.Default && curson_handle != IntPtr.Zero)
+ {
+ Functions.DestroyIcon(curson_handle);
+ curson_handle = IntPtr.Zero;
+ }
+
// Safe to clean managed resources
DestroyWindow();
if (Icon != null)

0 comments on commit 9988a2b

Please sign in to comment.