From 9988a2ba9c75d0db66a8426be6b8f47202ea4ce0 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Thu, 1 May 2014 14:27:20 +0200 Subject: [PATCH] [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. --- Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs | 6 ++++++ Source/OpenTK/Platform/Windows/WinGLNative.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs index 023f21891b..62e3c0ced0 100644 --- a/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs +++ b/Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs @@ -1057,6 +1057,12 @@ void Dispose(bool manual) { DestroyWindow(); } + + if (sdl_cursor != IntPtr.Zero) + { + SDL.FreeCursor(sdl_cursor); + sdl_cursor = IntPtr.Zero; + } } else { diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 36b91fafb6..19159540a0 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -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)