Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Only free EventData if it's successfully retrieved.
Browse files Browse the repository at this point in the history
- straight from http://who-t.blogspot.com/2009/07/xi2-and-xlib-cookies.html
- hopefully fixes random crash on some systems
  • Loading branch information
urkle committed May 23, 2013
1 parent 03281c7 commit 7b9f566
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -187,10 +187,11 @@ static char* X11_URIToLocal(char* uri) {
#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
static void X11_HandleGenericEvent(SDL_VideoData *videodata,XEvent event)
{
XGenericEventCookie *cookie = &event.xcookie;
XGetEventData(videodata->display, cookie);
X11_HandleXinput2Event(videodata,cookie);
XFreeEventData(videodata->display,cookie);
if (XGetEventData(videodata->display, &event)) {
XGenericEventCookie *cookie = &event.xcookie;
X11_HandleXinput2Event(videodata, cookie);
XFreeEventData(videodata->display, cookie);
}
}
#endif /* SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */

Expand Down

0 comments on commit 7b9f566

Please sign in to comment.