[comp.windows.x] XtConfigureWidget

ken@richsun.UUCP (Ken Marks) (03/30/89)

VERSION:
    R3

CLIENT MACHINE and OPERATING SYSTEM:
	any 

DISPLAY:
	any

WINDOW MANAGER:
	any

AREA:
	lib/Xt/Geometry.c

SYNOPSIS:
	In XtConfigureWidget(), a check is made to make sure the widget is
	realized before calling XConfigureWindow().  This check needs to
	be extended to the call to the widget's resize procedure.  It looks
	as though this second call might have been added later and the 
	braces were left out.

DESCRIPTION:
	See SYNOPSIS

REPEAT BY:
	Call XtConfigureWidget() with a different height or width than the
	widget was created with.  Do this before the widget is realized and
	the client will get a protocol error when the widget's resize
	routine tries to use its yet undefined window id.  The circumstances
	we found it occuring is while realizing a composite widget which
	calls XtConfigureWidget() on it's children before the children get
	a change to get realized.

SAMPLE FIX:
*** Geometry.c.old	Thu Mar 30 07:39:53 1989
--- Geometry.c	Thu Mar 30 07:41:08 1989
***************
*** 267,277 ****
      }
  
      if (mask != 0) {
! 	if (XtIsRealized(w))
  	    XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);
!         if ((mask & (CWWidth | CWHeight)) &&
! 	    XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
! 	        (*(w->core.widget_class->core_class.resize))(w);
      }
  } /* XtConfigureWidget */
  
--- 267,278 ----
      }
  
      if (mask != 0) {
! 	if (XtIsRealized(w)) {
  	    XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);
!             if ((mask & (CWWidth | CWHeight)) &&
! 	        XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
! 	            (*(w->core.widget_class->core_class.resize))(w);
! 	}
      }
  } /* XtConfigureWidget */