summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2013-07-21 12:21:22 -0700
committerSam Lantinga <slouken@libsdl.org>2013-07-21 12:21:22 -0700
commit6c92722aadebddd357a72fdc5f1d4247ea95f789 (patch)
tree9fb9839688dec0fabc7541746b40f15b554b4533 /src
parenta325c053a4821a0421adc2de3f4c31b7275c15df (diff)
Fixed cursor leak when quitting the mouse subsystem
Diffstat (limited to 'src')
-rw-r--r--src/events/SDL_mouse.c17
-rw-r--r--src/video/SDL_video.c2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 5536ab73b7..e9404f0577 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 d2b94898c8..8b3c2f0732 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);