[comp.windows.x] athena text widget funny

crouch@axion.bt.co.uk (Chris Rouch) (03/07/90)

I'm having problems using the R4 athena text widget. I'm creating a
popup shell and hanging a text widget and a close button off it. The
problem comes when I try and close the shell down. If I just type in the
widget there's no problem, but if I use meta-I to include a file the
program crashes. I can manually cut and paste the same file into the
widget without causing a crash. I'm sure I must be doing something
silly, 'cos xmh and xrn don't have this problem (although the popup
program in examples/Xaw does). A noddy example of this is shown below:

------------------------------
Widget shell;

void do_test(w,client_data,call_data)
Widget w;
XtPointer client_data, call_data;
{
void close_test();
Arg args[10];
char buffer[BIGBUFF];
Widget sub,title,editw,outer,closew;

	XtSetArg(args[0],XtNgeometry,"500x500");
	shell =XtCreatePopupShell("xsr", topLevelShellWidgetClass,toplevel,args,1);
    	sub =XtCreateManagedWidget("sub", panedWidgetClass, shell,NULL,0);
	title = XtCreateManagedWidget("title",labelWidgetClass,sub,NULL,0);
	XtSetArg(args[0],XtNeditType,XawtextEdit);
	XtSetArg(args[1],XtNstring,buffer);
	editw = XtCreateManagedWidget("edit",asciiTextWidgetClass,sub,args,2);
	XtSetArg(args[0],XtNskipAdjust,True);
	outer = XtCreateManagedWidget("tempButtons",boxWidgetClass,sub,args,1);
	closew = XtCreateManagedWidget("close",commandWidgetClass,outer,NULL,0);
	XtAddCallback(closew,XtNcallback,close_test,NULL);
	XtRealizeWidget(shell);
	XtSetKeyboardFocus( shell, sub );
	XtPopup(shell, XtGrabNone);
	
}

void close_test(w,client_data,call_data)
Widget w;
XtPointer client_data, call_data;
{
	XtPopdown(shell);
	XtDestroyWidget(shell);
}

----------------------

The end of the stack dump looks like this:

_XtWidgetToApplicationContext+0x70:     __XtWindowedAncestor    (0xB9F6C)
__XawTextExecuteUpdate+0x64:    _XtDestroyWidget(0xB9F6C)


If I replace the XtDestroyWidget() call with XtUnmapWidget() there's no
problem. 

Any help would be appreciated.

Thanks,

Chris
-----------------------------------------------------------------------------
Chris Rouch                                             crouch@axion.bt.co.uk
RT3141, BTRL, Martlesham Heath, Ipswich, England.              +44 473 646093

Pick a card. Any card. WRONG.