#include #include #include #include #include // // gcc -g -Wall -o quick_window quick_window.c -lX11 // // test case for a window which only exists briefly // causing a X server segfault // int main() { // Open the display Display *dpy = XOpenDisplay(NULL); assert(dpy); // Get some colors int blackColor = BlackPixel(dpy, DefaultScreen(dpy)); while (1) { int t; // Create the window Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200, 100, 0, blackColor, blackColor); // Map the window XMapWindow(dpy, w); XFlush(dpy); t = rand() % 500000; usleep(t); XDestroyWindow(dpy, w); XFlush(dpy); t = rand() % 500000; usleep(t); } return 0; }