[comp.windows.x] bug in contrib/widgets/MenuBox

solomon@gjetost.cs.wisc.edu (Marvin Solomon) (03/29/89)

			  X Window System Bug Report
			    xbugs@expo.lcs.mit.edu




VERSION:
    R3

CLIENT MACHINE and OPERATING SYSTEM:
	any big-endian (Sun, RT, ...)

DISPLAY:
	any

WINDOW MANAGER:
	any

AREA:
	contib/widgets/MenuBox

SYNOPSIS:
	In MenuShell.c, the fuction Setup() passes a pointer to a Position
	(i.e., a short) to XQueryPointer() where an (int *) is expected.

DESCRIPTION:
	See SYNOPSIS

REPEAT BY:
	The results are unpredictable.  Under some circumstances, everything
	works ok.  In at least one application, when run on Sun 4/110 (Sparc),
	popping up a menu causes a core dump.

SAMPLE FIX:
*** /tmp/,RCSt1015883	Wed Mar 29 07:09:43 1989
--- MenuShell.c	Thu Mar 16 17:19:11 1989
***************
*** 265,276 ****
  	Cardinal *num;
  {
  	Window root, child;
! 	int x_root, y_root;
  	MenuShellWidget msw = (MenuShellWidget) w;
  	unsigned int mask;
  
  	XQueryPointer( XtDisplay( w ), XtWindow( w ), &root, &child,
! 		      &x_root, &y_root, &msw->menu.cursor_x, 
! 		      &msw->menu.cursor_y, &mask);
  	return;
  }
--- 265,278 ----
  	Cardinal *num;
  {
  	Window root, child;
! 	int x_root, y_root, x_win, y_win;
  	MenuShellWidget msw = (MenuShellWidget) w;
  	unsigned int mask;
  
  	XQueryPointer( XtDisplay( w ), XtWindow( w ), &root, &child,
! 		      &x_root, &y_root, &x_win, &y_win, &mask);
! 	msw->menu.cursor_x = x_win;
! 	msw->menu.cursor_y = y_win;
! 	
  	return;
  }
	Marvin Solomon
	Computer Sciences Department
	University of Wisconsin, Madison WI
	solomon@cs.wisc.edu
	...seismo!uwvax!solomon