[comp.windows.x.motif] Intrinsics problem?

acs@pccuts.pcc.amdahl.com (Tony Sumrall) (04/04/91)

I'm running Wcl 1.05, X11R4 PL18 and Motif 1.1.1.  I *think* I've got an
Intrinsics problem but it may be a Wcl or a Motif problem.  If you're not
interested, hit 'n' now...I've got a short Wcl1.05 resource file, some
patches to Mri and directions on how to recreate the problem.  BTW, this
problem shows up on a SUN Sparc1 (SunOS 4.0.3) as well as on UTS (our UN*X
SYSVR3).  If you can help, would like more info or (dare I say it) have a
FIX, please reply to the address in my .sig.

First, I'll tell you where you could place breakpoints to see things happen,
then I'll include a short resource file and, finally, some context diffs for
Mri.c.  With all these things in place, you set XENVIRONMENT to the name of
the resource file, patch Mri.c and compile it and run your favorite
debugger.  The problem will manifest itself once the top level widget has
been realized and you click on it.

First, place a break in WcCreate.c, line 506 (it's a call to GetWcResources()
followed by a test of the return value of DuplicateType()).  Continue past
this break until the top level widget is realized.  When you click on the
button, it should cause another widget to be created and you'll stop at that
GetWcResources() again.  Step past this call and look at the res structure,
particularly look at res.callback.  This is a pointer to an XtCallbackList
which is terminated by a NULL entry.  Looks good, right?  Remember the
address of the XtCallbackList...you'll need it later.

Now, place a break in XtAddCallback().  The 4th time it gets called, it's to
add RemoveAllPMgr to the destroyCallback list.  Once this routine finishes,
the XtCallbackList is munged.

OK, that's all that I know.  Here's the resource file (search for ==== to
find then end of it):

Mri.wcChildren:		table
Mri.title:		Testing

*table.wcClassName:	XmpTable
*table.wcChildren:	searchbutton
!			Widget		c r cs rs opt
*table*layout:		searchbutton	0 0  1 1 hH

*searchbutton.wcClassName:	XmPushButton
*searchbutton.labelString:	Push me to coredump!
*searchbutton.activateCallback:	WcCreateChildrenCB(Mri, SearchShell)

*SearchShell.wcClassName:		TopLevelShell
*SearchShell.wcChildren:		searchDialog
*SearchShell.wcCallback:		DoNothingCB()
*SearchShell.destroyCallback:		DoNothingCB()
*SearchShell.title:			Search

!   The table widget which drives the search
*searchDialog.wcClassName:		XmpTable
*searchDialog.wcChildren:		sDlabel

!					Widget		c r cs rs opt
*searchDialog*layout:			sDlabel		0 0  7  1   h
*searchDialog.rowSpacing:	8
*searchDialog.columnSpacing:	1


*sDlabel.wcClassName:		XmLabel
*sDlabel.labelString:		Search Facility
====

Now, for the context diffs to Mri.c.  You should just be able to give this
file to patch once you've copied Mri.c to some safe place.  This time look
for ==== EndOfContext ====.

*** OldMri.c	Fri Dec 28 17:56:19 1990
--- Mri.c	Tue Apr  2 16:52:43 1991
***************
*** 43,56 ****
  
  #include <Xm/Xm.h>
  #include <ctype.h>
! #include <Wc/WcCreate.h>
  
! #include <Xmp/Table.h>
  
  /******************************************************************************
  **  Private Functions
  ******************************************************************************/
  
  extern void MriRegisterMotif();
  
  static void RegisterTable ( app )
--- 43,58 ----
  
  #include <Xm/Xm.h>
  #include <ctype.h>
! #include <X11/Wc/WcCreate.h>
  
! #include <X11/Xmp/Table.h>
  
  /******************************************************************************
  **  Private Functions
  ******************************************************************************/
  
+ static void DoNothingCB();
+ 
  extern void MriRegisterMotif();
  
  static void RegisterTable ( app )
***************
*** 64,69 ****
--- 66,89 ----
      RCP( "tableWidgetClass",            tableWidgetClass                );
  }
  
+ static void DoNothingCB(widget, unused, not_used)
+ Widget widget;
+ caddr_t unused, not_used;
+ {
+ 	int i;
+ 
+ 	for(i = 0; i < 10; i++)
+ 		;
+ }
+ 
+ static void RegisterApplicationCallbacks(app)
+ XtAppContext app;
+ {
+ #define RCALL(name, func, client) WcRegisterCallback(app, name, func, client)
+ 
+ 	RCALL("DoNothingCB",		DoNothingCB,		NULL);
+ }
+ 
  /******************************************************************************
  *   MAIN function
  ******************************************************************************/
***************
*** 95,100 ****
--- 115,123 ----
      app = XtWidgetToApplicationContext(appShell);
  
      /*  -- Register all application specific callbacks and widget classes */
+     RegisterApplicationCallbacks ( app );
+ 
+     /*  -- Register all application specific callbacks and widget classes */
      RegisterTable ( app );
  
      /*  -- Register all Motif classes and constructors */
***************
*** 107,109 ****
--- 130,137 ----
      XtRealizeWidget ( appShell );
      XtMainLoop ( );
  }
+ /**/
+ /* Local Variables:	*/
+ /* tab-width: 4	*/
+ /* tab-stop-list: (4 8 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)	*/
+ /* End:	*/
==== EndOfContext ====

That's it.  Hope you can help!
-- 
Tony Sumrall acs@pcc.amdahl.com <=> amdahl!pcc.amdahl.com!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]