/* Testcase for https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 * ('"x11perf -copypixpix500" crashes Xprt's PostScript DDX [PsCreateAndCopyGC'). * * * Preconditions to reproduce the crash: * - Only one screen - the Postscript DDX screen - must be available. * - No other client must be running. * * * Compile code with: * % gcc -g xprtcrash_bug1416.c -L/usr/X11R6/lib -lX11 -o xprtcrash_bug1416 * * Usage: * 1. Run Xprt server on display 40 * 2. Run this tool like this: * % (DISPLAY=:40 ./xprtcrash_bug1416 ) * * * Note: * The crash will occur in XCopyArea() when source and destination * pixmap are the same (which seems to be a quite common operation * for some tookits... ;-(), regardless whether the pixmap has any * content or not. */ #include #include #include int main(int ac, char **av) { Display *d; Screen *scr; int scrnum; int depth; Window w; Pixmap pix; GC fggc; XGCValues gcvalues; GC pgc; puts("start."); d = XOpenDisplay(NULL); XSynchronize(d, True); scr = XDefaultScreenOfDisplay(d); scrnum = XScreenNumberOfScreen(scr); depth = 8; w = XRootWindowOfScreen(scr); gcvalues.background = XWhitePixel(d, scrnum); gcvalues.foreground = XBlackPixel(d, scrnum); fggc = XCreateGC(d, w, GCBackground|GCForeground, &gcvalues); pix = XCreatePixmap(d, w, 500, 500, depth); /* It does not matter whether the source pixmap contains any * content or not */ #if 0 pgc = XCreateGC(d, pix, GCBackground|GCForeground, &gcvalues); XDrawPoint(d, pix, pgc, 50, 50); #endif XCopyArea(d, pix, pix, fggc, 400, 300, 500, 500, 200, 100); puts("done."); return EXIT_SUCCESS; }