[comp.windows.x] Problem with X11R4 Xt Toolkit function XtVaCreateManagedWidget

davidh@dent.Berkeley.EDU (David S. Harrison) (05/26/90)

I have run into a minor problem with the X toolkit and the Athena
Widget set under X11R4.  I was using the new XtVaCreateManagedWidget()
function to create a new label widget.  Below is the call that 
caused problems:

	item->checkLabels[i] =
	  XtVaCreateManagedWidget(DDS_ILEXLBL_NAME, labelWidgetClass,
				  item->bodyTable,
				  XtNlabel, item->user_spec.items[i].label,
				  XtNjustify, XtJustifyLeft,
				  NULL);

When I set certain (non-label widget) resources in my ~/.Xdefaults file, 
this call will free the string I pass in the XtNlabel slot.  Looking at 
Xt create widget code,  it appears the VarArgs code thinks my passed 
parameter is a XtVaTypedArg even though there is nothing in the call
to tell it to do so.  If I remove the offending resources, the string
isn't freed.  Further, if I change the order of the parameters, it
also seems to work, i.e.:

	item->checkLabels[i] =
	  XtVaCreateManagedWidget(DDS_ILEXLBL_NAME, labelWidgetClass,
				  item->bodyTable,
				  XtNjustify, XtJustifyLeft,
				  XtNlabel, item->user_spec.items[i].label,
				  NULL);

Unfortunately, I can't fully track down the problem because our libraries
are not installed for debugging.  Have I overlooked something in resource
management or variable argument list semantics or is this a bug?

			David Harrison
			UC Berkeley Electronics Research Lab
			(davidh@ic.Berkeley.EDU, ...!ucbvax!ucbcad!davidh)