Tk Source Code

Artifact [7733e7e2]
Login

Artifact 7733e7e20b8e13164f924ee94b3545236be178ed:

Attachment "leak.c" to ticket [918052ff] added by dgp 2004-09-25 04:24:46.
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
int
main(int argc, char **argv)
{
    Display *display;
    Font font;
    XColor fg, bg;
    int iter = 50;

    if (argc > 1) {
	iter = atoi(argv[1]);
    }
    display = XOpenDisplay(":0");
    font = XLoadFont(display, "cursor");
    fg.red = fg.green = fg.blue = 0;
    bg.red = bg.green = bg.blue = 65535;
    while (iter--) {
	Cursor cursor = XCreateGlyphCursor(display, font, font,
		XC_watch, XC_watch + 1, &fg, &bg);
	XFreeCursor(display, cursor);
    }
    XCloseDisplay(display);
}