Skip to content

Commit

Permalink
[SDL][Win] Destroy custom cursor on Close()
Browse files Browse the repository at this point in the history
X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.
  • Loading branch information
thefiddler committed May 1, 2014
1 parent c8c0d32 commit 9988a2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
Expand Up @@ -1057,6 +1057,12 @@ void Dispose(bool manual)
{ {
DestroyWindow(); DestroyWindow();
} }

if (sdl_cursor != IntPtr.Zero)
{
SDL.FreeCursor(sdl_cursor);
sdl_cursor = IntPtr.Zero;
}
} }
else else
{ {
Expand Down
6 changes: 6 additions & 0 deletions Source/OpenTK/Platform/Windows/WinGLNative.cs
Expand Up @@ -1639,6 +1639,12 @@ void Dispose(bool calledManually)
{ {
if (calledManually) if (calledManually)
{ {
if (Cursor != MouseCursor.Default && curson_handle != IntPtr.Zero)
{
Functions.DestroyIcon(curson_handle);
curson_handle = IntPtr.Zero;
}

// Safe to clean managed resources // Safe to clean managed resources
DestroyWindow(); DestroyWindow();
if (Icon != null) if (Icon != null)
Expand Down

0 comments on commit 9988a2b

Please sign in to comment.