Fixed bug 3880 - X Error upon quit since rev. 11607
authorSam Lantinga <slouken@libsdl.org>
Fri, 13 Oct 2017 19:30:34 -0700
changeset 116227abd358d3cec
parent 11621 8c8e18a2c390
child 11623 817e632daa35
Fixed bug 3880 - X Error upon quit since rev. 11607

Ozkan Sezer

Since changeset 11607:db7ee6a1ba6a, I am getting the following
error upon quit. Running testsprite2, clicking the mouse, and
quiting it is enough to trigger it. This is on my old Fedora9
x86-Linux:

X Error of failed request: BadCursor (invalid Cursor parameter)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Resource id in failed request: 0xb057340
Serial number of failed request: 905
Current serial number in output stream: 906

Reverting https://hg.libsdl.org/SDL/rev/db7ee6a1ba6a removes
the error.
src/events/SDL_mouse.c
     1.1 --- a/src/events/SDL_mouse.c	Fri Oct 13 09:50:04 2017 -0700
     1.2 +++ b/src/events/SDL_mouse.c	Fri Oct 13 19:30:34 2017 -0700
     1.3 @@ -580,13 +580,16 @@
     1.4          SDL_FreeCursor(cursor);
     1.5          cursor = next;
     1.6      }
     1.7 +    mouse->cursors = NULL;
     1.8  
     1.9      if (mouse->def_cursor && mouse->FreeCursor) {
    1.10          mouse->FreeCursor(mouse->def_cursor);
    1.11 +        mouse->def_cursor = NULL;
    1.12      }
    1.13  
    1.14      if (mouse->clickstate) {
    1.15          SDL_free(mouse->clickstate);
    1.16 +        mouse->clickstate = NULL;
    1.17      }
    1.18  
    1.19      SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,