[comp.windows.x.motif] XtGetValues gives Segmentation fault

pim@ele.tue.nl (Pim Buurman) (09/14/90)

I have a problem with the following widget-tree
(only the interesting parts are shown).

object	main_window : XmMainWindow {
	arguments { XmNmenuBar	   = command; };
	controls {
	  XmMenuBar 	    command;
	  XmScrolledWindow  scrollwindow;
	};
	callbacks {
	  MrmNcreateCallback = procedure create_proc (k_main_window);
	};
};

object	scrollwindow : XmScrolledWindow {
	arguments {
          XmNverticalScrollBar = XmScrollBar  scrollbar;
	  XmNworkWindow = space;
	};
	controls {
	  XmDrawingArea space;
	  XmScrollBar	scrollbar;
	};
	callbacks {
	  MrmNcreateCallback = procedure create_proc(k_scrollwindow);
	};
};

object	space : XmDrawingArea {
	callbacks {
	  MrmNcreateCallback = procedure create_proc(k_space);
	  XmNexposeCallback = procedure exposed(k_space);
	  XmNinputCallback = procedure button_handler(k_space);
	};
};

The first time when exposed is called, it crashes in XtGetValues
with a segmentation fault on our Apollo DN3000:

void exposed(w, tag, reason)
Widget		w;
int		*tag;
XmDrawingAreaCallbackStruct	*reason;
{
	Arg		wargs[2];
	Dimension	width, height;

	XtSetArg(wargs[0], XmNwidth, &width);
	XtSetArg(wargs[1], XmNheight, &height);
	XtGetValues(scrollwindow, wargs, 2);

I have tried several things, like changing scrollwindow to a
BulletinBoard, etc. Nothing worked.
However, on our Alliant FX/8 XtGetValues returns a heigth 0
and a wrong width.
On our HP 9000/800 XtGetValues returns the RIGHT values.
I know, that the HP is too clever with function arguments.

My questions are:
1) Is the tree correct ?
2) Might there be a programming error (somewhere else) ?
3) Is there a bug in motif ? We currently use
   Motif 1.0.A on Apollo and Alliant (self compiled), and
   Motif 1.0 on HP (from HP).

pim@ele.tue.nl (Pim Buurman) (09/20/90)

I asked last week about a problem I had with XtGetValues.
The code was:
{
	Dimension	width, height;
	Arg		args[2];

	XtSetArg(args[0], XmNwidth, &width);
	XtSetArg(args[1], XmNheight, &height);
	XtGetValues(w, args, 2);

After a long search I found out, that XtGetValues corrupted the stack.
This was due to the fact that it used INT's for width and height.
However, I had (sloppy) used the default include files (X11.3), which
stated that Dimension was a short.

Moral of the story: when you don't have X11.4 and Motif 1.1, set explicitly
a -I to the motif include files.

Pim.
-- 
______
Pim Buurman,  Phone: +(31)40-473238  Email: pim@ele.tue.nl
Eindhoven University of Technology, Dept. of Electr. Eng. (ES/EH 7.24)
P.O. Box 513, 5600 MB Eindhoven, The Netherlands