Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Only free EventData if it's successfully retrieved.

- 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 7b9f5660021d80a90c0a6263fdd81d5ce717b93d
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/video/x11/SDL_x11events.c
@@ -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 */

0 comments on commit 7b9f566

Please sign in to comment.