graeme@labtam.labtam.oz (Graeme Gill) (12/19/90)
There seems to be a bug in ddx/miwindow.c that crashes the X11R4
server. It seems likely that it will crash almost every implementation
based on the generic MIT server
This shar file contains a little client program called miwindowbug
to exercise the bug. There is also an Imakefile.
If this bug seems to be undiscovered, I will post a bug report.
Graeme Gill
Labtam Australia
#!/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
# Files unpacked will be owned by you and have default permissions.
echo extracting - Imakefile
sed 's/^X//' > Imakefile << 'SHAR_EOF'
X INCLUDES = -I$(TOP)
X DEPLIBS = $(DEPXLIB)
XLOCAL_LIBRARIES = $(XLIB)
X SYS_LIBRARIES = -lm
X
XSimpleProgramTarget(miwindowbug)
SHAR_EOF
touch 1219140190 Imakefile
echo extracting - miwindowbug.c
sed 's/^X//' > miwindowbug.c << 'SHAR_EOF'
X/*
X * Demonstrate bug in miwindow.c
X *
X * Author: Graeme Gill
X *
X * Organisation: Labtam Australia
X *
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X/* stuff for X windows */
Xchar miwindowbug[] = {"miwindowbug"};
XDisplay *mydisplay;
XWindow mywindow;
XGC mygc;
XXEvent myevent;
XXSizeHints myhint;
Xint myscreen;
Xunsigned long myforeground,mybackground;
Xint done;
X
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X {
X int i,j;
X
X /* open the display */
X mydisplay = XOpenDisplay("");
X if(!mydisplay)
X error("Unable to open display");
X myscreen = DefaultScreen(mydisplay);
X mybackground = BlackPixel(mydisplay,myscreen);
X myforeground = WhitePixel(mydisplay,myscreen);
X
X myhint.x = 20;
X myhint.y = 20;
X myhint.width = 150;
X myhint.height = 150;
X myhint.flags = PPosition | USSize;
X
X mywindow = XCreateSimpleWindow(mydisplay,
X DefaultRootWindow(mydisplay),
X myhint.x,myhint.y,myhint.width,myhint.height,
X 5, myforeground,mybackground);
X XSetStandardProperties(mydisplay,mywindow,miwindowbug,miwindowbug,None,
X argv,argc, &myhint);
X
X mygc = XCreateGC(mydisplay,mywindow,0,0);
X XSetBackground(mydisplay,mygc,mybackground);
X XSetForeground(mydisplay,mygc,myforeground);
X
X XSelectInput(mydisplay,mywindow,
X ButtonPressMask | ExposureMask);
X
X XMapRaised(mydisplay,mywindow);
X
X /* Main event loop */
X done = 0;
X while(done == 0)
X {
X XNextEvent(mydisplay,&myevent);
X switch(myevent.type)
X {
X case Expose:
X if(myevent.xexpose.count == 0)
X {
X XFillRectangle(mydisplay,mywindow,mygc,10,10,100,100);
X /* This is perfectly legal ! */
X XClearArea(mydisplay,mywindow,20,20,0xffff,0xffff,False);
X }
X break;
X case MappingNotify:
X XRefreshKeyboardMapping(&myevent);
X break;
X case ButtonPress:
X done = 1;
X break;
X }
X }
X XFreeGC(mydisplay,mygc);
X XDestroyWindow(mydisplay,mywindow);
X XCloseDisplay(mydisplay);
X exit(0);
X }
X
X error(s)
X char *s;
X {
X fprintf(stderr,"Error; miwindowbug: %s\n",s);
X if(mydisplay)
X {
X if(mygc)
X XFreeGC(mydisplay,mygc);
X if(mywindow)
X XDestroyWindow(mydisplay,mywindow);
X XCloseDisplay(mydisplay);
X }
X exit(-1);
X }
X
X
SHAR_EOF
touch 1219140090 miwindowbug.cklee@wsl.dec.com (Ken Lee) (12/20/90)
In article <5795@labtam.labtam.oz>, graeme@labtam.labtam.oz (Graeme Gill) writes: > XClearArea(mydisplay,mywindow,20,20,0xffff,0xffff,False); Yes, I think I've seen this problem reported here 3 or 4 times. The sample server is not very good about checking for out-of-bounds conditions. -- Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@wsl.dec.com uucp: uunet!decwrl!klee