XTest and multiple pointers

Florian Echtler floe at butterbrot.org
Tue Sep 9 06:12:07 PDT 2008

> > we're currently trying to control multiple X pointers through XTest.
> > Moving them using XTestFakeDeviceMotionEvent works as expected; however,
> > sending a button event using XTestFakeDeviceButtonEvent doesn't. 
> > In fact, the test program from [1] segfaults in XNextEvent
> > (xorg/lib/libX11/src/NextEvent.c, line 51). qelt (and therefore
> > dpy->head) doesn't point anywhere sensible, so is this perhaps an
> > internal bug?
> This is usually caused by the event being passed in not being the right size.
> Xlib is picky about the size of events, so you must make sure you always pass
> in an XEvent struct (96 bytes), even if what you actually use is a
> XDeviceMotionEvent (or whatever).
> Could this be the cause of your issue?
As mentioned, we were using your test program.. and that does pass an
XEvent struct. The segfault happens here:

XNextEvent (
        register Display *dpy,
        register XEvent *event)
        register _XQEvent *qelt;


        if (dpy->head == NULL)
        qelt = dpy->head;
        *event = qelt->event; // <- CRASH
        _XDeq(dpy, NULL, qelt);
        return 0;

qelt is an invalid pointer, meaning dpy->head is invalid, too. I can't
imagine that this happens from userspace..

Thanks again, Yours, Florian
0666 - Filemode of the Beast

More information about the xorg mailing list