[comp.windows.x] Xhp.patch.works.tar.Z

martin@CITI.UMICH.EDU (02/22/89)

This file is on expo.lcs.mit.edi now.

The fixes should be applied to the unpatched sources from the R3 tape.

Here is the README file from it.
--------------------------------
This file contains diffs which fix the Xw widgets even more!  I have diffed my
files with what was originally on the R3 tape in contrib/widgets/Xhp/Xw.  My
application program now works, where it previously dumped core.  All of the
client programs that I have tested with the fixed widgets work (including all
of the Xhp test programs on the tape).  This may well tide us over till HP
wakes up about this code.

There are still some minor bugs somewhere in the code.  For instance, some
test programs *look* prettier with the R2 Xt/Xw combo.  I don't know how to
make someone elses code look and smell prettier, I can just get it to stop
dumping core files all over the place.

You will be interested to note that most all of the bugs that I found were
fixes to code which used int and Dimension/Position typedefs interchangeably.
I suppose that in the change from R2 to R3 some unkind soul changed or was
told to change those two typedefs from ints to shorts.  They probably broke
half of the widgets in existance by changing just that one token.

from ./lib/Xt/CHANGES:
     o	the definitions of the types Dimension and Position have
	changed.  Correct code will not be affected by this, but code
	that assumed that Dimensions and Positions were ints may
	break.  In particular, all cases where pointers to such fields
	are used will need to be checked.  In the standard interfaces,
	the only such places are calls to XtMakeResizeRequest and
	XtGetValues.  Widgets that pass pointers in callbacks or other
	public interfaces will also need to be checked.  This change
	plus the preceeding bugfix require all application calls to
	XtGetValues to be checked for correctness, especially those
	that refer to XtNx, XtNy, XtNwidth, XtNheight and
	XtNborderWidth.

Get that about correct code!  Nobody (get me? NOBODY!) writes correct code.
Especially when it used to work!

The nastiest bug of all was one which involved the bubbling of calls in
XtSetValues.  It seems that in R2 the newWidget and requestWidget were kept as
temp structures on the stack.  The oldWidget (oldValues) was the real lasting
heap storage copy, and it was explicitly passed by Xw code (with a big comment
saying why) into this funky XtAugmentTranslations call and then certain values
were copied out of it (namely pointers to parts of itself) into the temporary
newWidget.  The newWidget was then copied back into the real Widget by the
caller (XtSetValues).  Get that?  Now comes R3.  In R3, MIT people made an
improvement to XtSetValues.  NewWidget is the Real copy, oldWidget and
requestWidget are temporary and on the stack.  So now "pointers to parts of
itself" from above are now locations the stack and they get put into the heap
structure.  Too bad.  Pointers get clobbered (the works). If you are
interested look at the difference between R2 and R3 XtSetValues, and at the
diffs to Manager.c and Primitive.c .

I suggest that you place your copy of the Xw widget set in the $(LIBSRC)
directory along side of the regular X, Xt, and Xaw.  It really does belongs
there now that it works.  Install the include files in /usr/include/Xw, and
include <Xw/File.h>.  And above all have fun doing it!

Martin Friedmann
Martin@citi.umich.edu