| Summary: | X11_KeyRepeat crash | ||
|---|---|---|---|
| Product: | SDL | Reporter: | driedfruit <driedfruit> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | CC: | icculus, jujulicca, ondra.hosek |
| Version: | HG 2.0 | Keywords: | target-2.0.0 |
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: |
gdb backtrace
valgrind output minimal test program patch to workaround this libXi bug |
||
Created attachment 1117 [details]
valgrind output
Created attachment 1118 [details]
minimal test program
I can't reproduce this with the minimal program (and modification) you provided. * Xlib 1.5.0 * X server 1.14.1 * awesome v3.5.1-1-g2d31033 (window manager) * tip-of-the-trunk SDL2 What is your X server version? Which window manager are you using? * i686 * Xlib 1.4.1 * Xserver 1.9.4 * awesome 3.4.8 (wm) * latest SDL hg and * amd64 * Xlib 1.3.3-4 * X server 1.7.7-14 * enlightenment wm (don't have info on the version right now) * latest SDL hg After investigating more upon it, I've found that the reason for this crash has nothing to do with SDL2, but all with libXi: http://cgit.freedesktop.org/xorg/lib/libXi/commit/?id=af65475b1f6b7209750220a74aaad9968d54aaf7 Applying this patch to 1.4.1 libXi fixes the issue. It's part of the more recent libXi releases. Sorry! Created attachment 1236 [details] patch to workaround this libXi bug This patch is a workaround for the bug in libXi. It avoids calling X functions that trigger the bug. See the forum thread http://forums.libsdl.org/viewtopic.php?p=38071 for my explanation of what this workaround is intended to do. Reopened to investigate Steve's patch. That email thread has some really impressive research. This patch looks good to me. Sam, you want to give this a looking at before I apply it? Thanks, --ryan. It looks good to me. Go for it. Great work everyone! This patch is now http://hg.libsdl.org/SDL/rev/c244bc85fb84, thanks! --ryan. *** Bug 1683 has been marked as a duplicate of this bug. *** |
Created attachment 1116 [details] gdb backtrace On X11, sometimes, when you move your mouse and release the keyboard key at the same time, you get a SIGSERV crash. I've "tracked" it down to the X11_KeyRepeat function in SDL_x11events.c. The function looks for next X11 event in the queue and compares it to the current one, working around keyboard auto-repeat feature of X11. The culprit is XPeekEvent, which either crashes itself, either corrupts something, so next XNextEvent call crashes. To easier reproduce this, change "2" to "10" or a larger value here: src/video/x11/SDL_x11events.c:113 ((peekevent.xkey.time-event->xkey.time) < 2)) { You're aiming to "inject" a MotionNotify event inbetween the KeyRelease and the auto-repeated KeyPress. For me, it crashes reliably when this happens. I've tested this on different hardware (32 and 64 bit) and different libX11 versions, it doesn't seem to be an X bug, but an SDL2 bug :(