Fixed memory leak in Cocoa mouse code

The video quit call cleans up the mouse cursor driver data, which happens after mouse quit
This commit is contained in:
Sam Lantinga 2017-10-12 13:28:48 -07:00
parent f4cd68a537
commit 1887c54c68
1 changed files with 2 additions and 2 deletions

View File

@ -81,6 +81,8 @@ SDL_MouseInit(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_zerop(mouse);
SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
SDL_MouseNormalSpeedScaleChanged, mouse); SDL_MouseNormalSpeedScaleChanged, mouse);
@ -587,8 +589,6 @@ SDL_MouseQuit(void)
SDL_free(mouse->clickstate); SDL_free(mouse->clickstate);
} }
SDL_zerop(mouse);
SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
SDL_MouseNormalSpeedScaleChanged, mouse); SDL_MouseNormalSpeedScaleChanged, mouse);