openmotif 2.3.2 bug in 64 bits under Snow Leopard MacPorts 1.8.2

Felix Ingrand felix at laas.fr
Fri Jan 15 08:22:16 PST 2010


I have a weird openmotif  2.3.2 bug in 64 bits  under Snow Leopard MacPorts 1.8.2 

The following code: 
     XmListDeselectAllItems(XmSelectionBoxGetChild(selectOpDialog, XmDIALOG_LIST));
sometimes crashes
tracing it in openMotif, I have change these 2 functions (note the fprintf I have added).

void
XmListDeselectAllItems(Widget w)
{
  XmListWidget  lw = (XmListWidget) w;
  int  i;

  fprintf(stderr,"w: %ld %p\n", sizeof(w), w);

  _XmWidgetToAppContext(w);

  _XmAppLock(app);

  if (lw->list.itemCount < 1) {
    _XmAppUnlock(app);
    return;
  }

  if (lw->list.selectedItemCount > 0)
    {
      for (i = 0; i < lw->list.selectedPositionCount; i++)
	{
	  int pos = lw->list.selectedPositions[i] - 1;

	  lw->list.InternalList[pos]->selected = FALSE;
	  lw->list.InternalList[pos]->last_selected = FALSE;
	  DrawItem((Widget) lw, pos);
	}

      ClearSelectedList(lw);
      ClearSelectedPositions(lw);
    }
  _XmAppUnlock(app);
}

and

Widget 
XmSelectionBoxGetChild(
        Widget sb,
#if NeedWidePrototypes
        unsigned int which )
#else
        unsigned char which )
#endif /* NeedWidePrototypes */
{
/****************/
	Widget	child = NULL;
	_XmWidgetToAppContext(sb);
	_XmAppLock(app);

	switch (which)
	{
		case XmDIALOG_LIST:
			child = SB_List (sb);
			break;

		case XmDIALOG_LIST_LABEL:
			child = SB_ListLabel (sb);
			break;

		case XmDIALOG_SELECTION_LABEL:
			child = SB_SelectionLabel (sb);
			break;

		case XmDIALOG_WORK_AREA:
			child = SB_WorkArea (sb);
			break;

		case XmDIALOG_TEXT:
			child = SB_Text (sb);
			break;

		case XmDIALOG_SEPARATOR:
			child = SB_Separator (sb);
			break;

		case XmDIALOG_OK_BUTTON:
			child = SB_OkButton (sb);
			break;

		case XmDIALOG_APPLY_BUTTON:
			child = SB_ApplyButton (sb);
			break;

		case XmDIALOG_CANCEL_BUTTON:
			child = SB_CancelButton (sb);
			break;

		case XmDIALOG_HELP_BUTTON:
			child = SB_HelpButton (sb);
			break;

		case XmDIALOG_DEFAULT_BUTTON:
			child = SB_DefaultButton (sb);
			break;

		default:
			XmeWarning( (Widget) sb, WARN_CHILD_TYPE);
			break;
	}
	_XmAppUnlock(app);


     fprintf(stderr, "child: %ld %p\n", sizeof(child), child);


	return (child);
}


I get the following trace and crash:


child: 8 0x100a9c260
w: 8 0x100a9c260
child: 8 0x100a9c260
w: 8 0x100a9c260
child: 8 0x100aa8880
w: 8 0xaa8880

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000aa8888
0x00000001003db1fc in XtWidgetToApplicationContext ()
(gdb) 

Note the last w... For some reasons, during one of the call, the passed argument gets its 33rd bit cleared (like if it was casted in 32 bits at some point)....

Any idea?

-- 
     Felix
Motivation: reward, bonus, carrot and stick... we got it wrong:
http://tinyurl.com/yayq6u6




More information about the macports-users mailing list