[PATCH xcb] Fix hanging issue in _XReply

Tatu Frisk tatu.frisk at iki.fi
Wed May 23 20:37:50 UTC 2018


I just noticed this had made it here. I pasted below a reproducer app. The 
thread blocks until a key is pressed.

About the patch itself, it looks like the assumption of the patch is also 
made on xcb_io.c, line 347, where it is more cautiously called a 
"reasonable claim".



#include <X11/Xlib.h>
#include <stdio.h>
#include <pthread.h>

Display* d;

void* thread(void *ptr)
{
     int actualCount;
     XListFonts(d, "", 1, &actualCount);
     printf("thread finished\n");
}

int main(void) {
    pthread_t t;
    XEvent e;
    Window w;
    int s;

    XInitThreads();

    d = XOpenDisplay(NULL);
    s = DefaultScreen(d);
    w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1,
 			   BlackPixel(d, s), WhitePixel(d, s));
    XSelectInput(d, w, KeyPressMask);
    XMapWindow(d, w);

    pthread_create( &t, NULL, thread, NULL);

    while (1) {
       XNextEvent(d, &e);
       if (e.type == KeyPress)
          break;
     }

    XCloseDisplay(d);
    printf("main finished\n");
    return 0;
}



More information about the xorg-devel mailing list