luke@umnstat.uucp (Luke Tierney) (09/24/90)
We recently installed ULTRIX 4.0 and the 4.01 upgrade on a Decstation 3100 and ran into two problems that may be bugs in the X rervers. The first problem involves the XDrawPoints routine and may only affect the affects the Xmfb server. The second involves freeing colors allocated with XAllocColor seems to affect both Xmfb and Xcfb servers. I have put together two little programs that exercise the problems; they are contained in the shar file attached below. I am not sure whom to contact about this, so I am posting this note here in the hope that someone at DEC may be able to relay this to the proper place. Luke Tierney luke@umnstat.stat.umn.edu ------------------------------(cur here)----------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # dxbugs # This archive created: Sat Sep 22 15:02:23 1990 export PATH; PATH=/bin:$PATH if test ! -d 'dxbugs' then mkdir 'dxbugs' fi cd 'dxbugs' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else cat << \SHAR_EOF > 'Makefile' all: drawpointsbug freecolorbug drawpointsbug: drawpointsbug.o cc -o drawpointsbug drawpointsbug.o -lX11 freecolorbug: freecolorbug.o cc -o freecolorbug freecolorbug.o -lX11 clean: rm -f *~ *.o cleanall: make clean rm -f drawpointsbug freecolorbug SHAR_EOF fi # end of overwriting check if test -f 'README' then echo shar: will not over-write existing file "'README'" else cat << \SHAR_EOF > 'README' The two little programs in this directory exercise two possible bugs I have come accress. BUG1 ==== The XDrawPoints routine does not seem to work in the CoordModePrevious. The program drawdpointsbug draws three points using this routine alternating between CoordModeOrigin and CoordModePrevious. Initially CoordModeOrigin is used, then each time the draw() routine is called the mode is switched. draw() is called in response to a click. When the Displaying on an MIT R4 server for a sun 3/50 clicking has no effect. On the ULTRIX 4.01 server the points are not in a line when using the CoordModePrevious mode. I think the ULTRIX 3.x servers may not have had this problem. BUG2 ==== Freeing a color allocated with XAllocColor or XAllocNamedColor produces an error. The program freecolorbug exercises this. The problem does not occur on an MIT R4 server running on a sun 3/50. I think it also does not occur in ULTRIX 3.x servers. SHAR_EOF fi # end of overwriting check if test -f 'drawpointsbug.c' then echo shar: will not over-write existing file "'drawpointsbug.c'" else cat << \SHAR_EOF > 'drawpointsbug.c' #include <X11/Xlib.h> #include <stdio.h> #define TRUE 1 #define FALSE 0 /* Options */ #define OWN_DASHES FALSE #define SOLID FALSE #define FIX_GC FALSE #define DASH_LENGTH 4 #define TOP 100 #define LEFT 100 #define WIDTH 400 #define HEIGHT 400 #define POINTS 3 #define YSTEP 3 #define START 100 Display *dpy; int screen; GC gc; Window win; XPoint rpts[POINTS], apts[POINTS]; main() { char *display_name = NULL; unsigned long valuemask; XGCValues values; XEvent report; int done = FALSE; int i; /* set up the point arrays */ rpts[0].x = START; rpts[0].y = START; for (i = 1; i < POINTS; i++) { rpts[i].x = -1; rpts[i].y = -YSTEP; } for (i = 0; i < POINTS; i++) { apts[i].x = START - i; apts[i].y = START - YSTEP * i; } /* connect to X server */ if ((dpy = XOpenDisplay(display_name)) == NULL) { fprintf(stderr, "%s: can't connect to X server %s\n", "bug", XDisplayName(display_name)); exit(-1); } /* get the default screen */ screen = DefaultScreen(dpy); /* make GC */ valuemask = 0; /* ignore values */ gc = XCreateGC(dpy, RootWindow(dpy, screen), valuemask, &values); XSetForeground(dpy, gc, BlackPixel(dpy, screen)); XSetBackground(dpy, gc, WhitePixel(dpy, screen)); /* create the window */ win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), LEFT, TOP, WIDTH, HEIGHT, 1, BlackPixel(dpy, screen), WhitePixel(dpy, screen)); XSelectInput(dpy, win, ExposureMask | ButtonPressMask); XStoreName(dpy, win, "Click In Me"); /* Display (map) the window */ XMapWindow(dpy, win); while (! done) { XNextEvent(dpy, &report); if (win == report.xany.window) { switch(report.type) { case Expose: if (report.xexpose.count == 0) draw(); break; case ButtonPress: draw(); break; default: break; } } } XCloseDisplay(dpy); } /**************************************************************************/ /** **/ /** Drawing Functions **/ /** **/ /**************************************************************************/ draw() { static int relative = FALSE; XClearWindow(dpy, win); if (relative) XDrawPoints(dpy, win, gc, rpts, POINTS, CoordModePrevious); else XDrawPoints(dpy, win, gc, apts, POINTS, CoordModeOrigin); relative = ! relative; } SHAR_EOF fi # end of overwriting check if test -f 'freecolorbug.c' then echo shar: will not over-write existing file "'freecolorbug.c'" else cat << \SHAR_EOF > 'freecolorbug.c' #include <X11/Xlib.h> #include <stdio.h> #define TRUE 1 #define FALSE 0 #define MULTIPLIER 62535 #define MYRED 0.8 #define MYGREEN 0.2 #define MYBLUE 0.2 main() { char *display_name = NULL; Display *dpy; int screen; Colormap cmap; XColor color; /* connect to X server */ if ((dpy = XOpenDisplay(display_name)) == NULL) { fprintf(stderr, "%s: can't connect to X server %s\n", "bug", XDisplayName(display_name)); exit(-1); } /* get the default screen */ screen = DefaultScreen(dpy); /* get the default color map */ cmap = DefaultColormap(dpy, screen); /* allocate a color */ color.red = MULTIPLIER * MYRED; color.green = MULTIPLIER * MYGREEN; color.blue = MULTIPLIER * MYBLUE; if (XAllocColor(dpy, cmap, &color) == 0) { fprintf(stderr, "can't allocate color\n"); exit(-1); } /* free the color */ XFreeColors(dpy, cmap, &color.pixel, 1, 0); XCloseDisplay(dpy); fprintf(stderr, "No Error\n"); } SHAR_EOF fi # end of overwriting check cd .. # End of shell archive exit 0
hoyt@laura.alf.dec.com (Kurt Hoyt) (09/24/90)
In article <1990Sep23.171606.16370@cs.umn.edu>, luke@umnstat.uucp (Luke Tierney) writes: |> From: luke@umnstat.uucp (Luke Tierney) |> We recently installed ULTRIX 4.0 and the 4.01 upgrade on a Decstation |> 3100 and ran into two problems that may be bugs in the X rervers. The [stuff deleted] |> Luke Tierney |> luke@umnstat.stat.umn.edu [more stuff deleted] |> BUG2 |> ==== |> |> Freeing a color allocated with XAllocColor or XAllocNamedColor |> produces an error. The program freecolorbug exercises this. The |> problem does not occur on an MIT R4 server running on a sun 3/50. I |> think it also does not occur in ULTRIX 3.x servers. [code deleted] I ran this program on a DECstation 3100 with ULTRIX 4.0 (and the mandatory patches) using Xcfb. Repeatedly running freecolorbug resulted in the message "No Error" each time. Do we have differing environments of some kind? -- Kurt in Atlanta | "A Swiss court has ruled that cowbells are a hoyt@decatl.alf.dec.com | form of noise pollution and cows must be hoyt@laura.alf.dec.com | deprived of them immediately." National Review