src/video/x11/SDL_x11events.c
changeset 7214 5b31583ecf9e
parent 7199 6d4cad3fb837
child 7396 a36ab6149a10
--- a/src/video/x11/SDL_x11events.c	Tue May 21 22:48:50 2013 -0700
+++ b/src/video/x11/SDL_x11events.c	Thu May 23 18:45:14 2013 -0400
@@ -187,10 +187,11 @@
 #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 */