From 8d909ffbcac6be24b882b34c44f54d00d23b4bb6 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 21 Jul 2013 12:21:22 -0700 Subject: [PATCH] Fixed cursor leak when quitting the mouse subsystem --- src/events/SDL_mouse.c | 17 +++++++++++++++++ src/video/SDL_video.c | 2 -- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 5536ab73b..e9404f057 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -361,6 +361,23 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y) void SDL_MouseQuit(void) { + SDL_Cursor *cursor, *next; + SDL_Mouse *mouse = SDL_GetMouse(); + + SDL_ShowCursor(1); + + cursor = mouse->cursors; + while (cursor) { + next = cursor->next; + SDL_FreeCursor(cursor); + cursor = next; + } + + if (mouse->def_cursor && mouse->FreeCursor) { + mouse->FreeCursor(mouse->def_cursor); + } + + SDL_zerop(mouse); } Uint32 diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index d2b94898c..8b3c2f073 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2247,8 +2247,6 @@ SDL_VideoQuit(void) SDL_EnableScreenSaver(); - SDL_ShowCursor(1); - /* Clean up the system video */ while (_this->windows) { SDL_DestroyWindow(_this->windows);