[Xcb] Segfault in XNextEvent() when using XCB

Peter Hutterer mailinglists at who-t.net
Sun Dec 3 16:44:41 PST 2006


Nevermind that. It was caused by some older version of XCB. Doesn't  
do this any more with the latest git release.

Cheers,
   Peter

--
Multi-Pointer X Server
http://wearables.unisa.edu.au/mpx


On 28/11/2006, at 19:19 , Peter Hutterer wrote:

> Hey guys,
>
> I found a problem with running some little apps.
> I use some very simple apps to check the event stream from the X  
> server. All of them started crashing when I started testing MPX  
> today. The X Server and XCB are both pulled from git (X server last  
> week, XCB today).
>
> There are some weird behaviours:
> * Using plain Xlib (in Ubunty Breezy) works, linking against XCB  
> makes it crash.
> * Using PointerMotionMask as well instead of just DeviceMotion will  
> not crash the program,
> * If I hook up xmond between the server and the client, I can see  
> the input extension events but they never arrive at the client.  
> From what I can tell by debugging the X server before they are sent  
> out, their values are sane.
>
> Here is a very simple program that will crash.
> =======
> #include <stdio.h>
> #include <X11/X.h>
> #include <X11/Xlib.h>
> #include <X11/extensions/XInput.h>
>
> int main (int argc, char** argv)
> {
>     Display* display;
>     Window win;
>     XDevice* dev;
>     XEventClass class_1;
>     XSetWindowAttributes attr;
>     int screen;
>     int win_width, win_height;
>     int type_1;
>
>     display = XOpenDisplay(argv[1]);
>     screen = DefaultScreen(display);
>     assert(display != NULL);
>
>     win_width = 640;
>     win_height = 480;
>
>
>     dev = XOpenDevice(display, atoi(argv[2]));
>     assert(dev != NULL);
>     DeviceMotionNotify(dev, type_1, class_1);
>
>     attr.background_pixel = WhitePixel(display, screen);
>     attr.event_mask = ExposureMask | StructureNotifyMask; //|  
> PointerMotionMask;
>
>     win = XCreateWindow(display,
>             RootWindow(display, 0),
>             0, 0,
>             win_width,
>             win_height,
>             7,
>             DefaultDepth(display, 0),
>             InputOutput,
>             DefaultVisual(display, 0),
>             CWBackPixel | CWEventMask,
>             &attr);
>
>     XMapWindow(display, win);
>
>     XSelectExtensionEvent(display, win, &class_1, 1);
>     XSync(display, False);
>
>
>     while(1)
>     {
>         XEvent e;
>         XNextEvent(display, &e);
>         XDeviceMotionEvent* mev;
>
>         switch(e.type)
>         {
>             default:
>                 if (e.type == type_1)
>                 {
>                     printf("Motion notify\n");
>                     printf(" state %d\n", mev->state);
>                     printf(" devstate %d\n", mev->device_state);
>                 } else
>                 {
>                     printf("Unknown event type %d\n", e.type);
>                 }
>                 break;
>         }
>     }
>
>     XCloseDisplay(display);
>     return 0;
> }
>
> =======
>
> (gdb) run roo:1 2
> Starting program: /home/whot/code/junk/X/XCB_segfault/xcbsegfault  
> roo:1 2
> Unknown event type 19
> Unknown event type 12
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7d5985c in memcpy () from /lib/tls/i686/cmov/libc.so.6
> (gdb) bt
> #0  0xb7d5985c in memcpy () from /lib/tls/i686/cmov/libc.so.6
> #1  0xb7e747f2 in XNextEvent (dpy=0xbfc496e4, event=0xbfc496e4) at  
> NextEvent.c:52
> #2  0x08048895 in main (argc=3, argv=0xbfc49844) at main.c:55
> (gdb) up 1
> #1  0xb7e747f2 in XNextEvent (dpy=0xbfc496e4, event=0xbfc496e4) at  
> NextEvent.c:52
> 52              *event = qelt->event;
> (gdb)
>
>
>
> Cheers,
>   Peter
>
> --
> Multi-Pointer X Server
> http://wearables.unisa.edu.au/mpx
>
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb



More information about the Xcb mailing list