[SDL][Win] Destroy custom cursor on Close()
authorthefiddler <stapostol@gmail.com>
Thu, 1 May 2014 12:27:20 +0000 (14:27 +0200)
committerthefiddler <stapostol@gmail.com>
Thu, 1 May 2014 12:27:20 +0000 (14:27 +0200)
X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.

Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
Source/OpenTK/Platform/Windows/WinGLNative.cs

index 023f218..62e3c0c 100644 (file)
@@ -1057,6 +1057,12 @@ namespace OpenTK.Platform.SDL2
                         {
                             DestroyWindow();
                         }
+
+                        if (sdl_cursor != IntPtr.Zero)
+                        {
+                            SDL.FreeCursor(sdl_cursor);
+                            sdl_cursor = IntPtr.Zero;
+                        }
                     }
                     else
                     {
index 36b91fa..1915954 100644 (file)
@@ -1639,6 +1639,12 @@ namespace OpenTK.Platform.Windows
             {
                 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)