Fixed cursor leak when quitting the mouse subsystem
authorSam Lantinga <slouken@libsdl.org>
Sun, 21 Jul 2013 12:21:22 -0700
changeset 74937bfda8f0bfdf
parent 7492 98de3e4f1c36
child 7494 25575b2a188f
Fixed cursor leak when quitting the mouse subsystem
src/events/SDL_mouse.c
src/video/SDL_video.c
     1.1 --- a/src/events/SDL_mouse.c	Sun Jul 21 11:52:16 2013 -0700
     1.2 +++ b/src/events/SDL_mouse.c	Sun Jul 21 12:21:22 2013 -0700
     1.3 @@ -361,6 +361,23 @@
     1.4  void
     1.5  SDL_MouseQuit(void)
     1.6  {
     1.7 +    SDL_Cursor *cursor, *next;
     1.8 +    SDL_Mouse *mouse = SDL_GetMouse();
     1.9 +
    1.10 +    SDL_ShowCursor(1);
    1.11 +
    1.12 +    cursor = mouse->cursors;
    1.13 +    while (cursor) {
    1.14 +        next = cursor->next;
    1.15 +        SDL_FreeCursor(cursor);
    1.16 +        cursor = next;
    1.17 +    }
    1.18 +
    1.19 +    if (mouse->def_cursor && mouse->FreeCursor) {
    1.20 +        mouse->FreeCursor(mouse->def_cursor);
    1.21 +    }
    1.22 +
    1.23 +    SDL_zerop(mouse);
    1.24  }
    1.25  
    1.26  Uint32
     2.1 --- a/src/video/SDL_video.c	Sun Jul 21 11:52:16 2013 -0700
     2.2 +++ b/src/video/SDL_video.c	Sun Jul 21 12:21:22 2013 -0700
     2.3 @@ -2247,8 +2247,6 @@
     2.4  
     2.5      SDL_EnableScreenSaver();
     2.6  
     2.7 -    SDL_ShowCursor(1);
     2.8 -
     2.9      /* Clean up the system video */
    2.10      while (_this->windows) {
    2.11          SDL_DestroyWindow(_this->windows);