1.5.25: Problem with XtAppAddWorkProc and OptionMenu

Wakker, P.H. (Pieter) wakker@nrg.eu
Fri Jul 10 08:20:00 GMT 2009


I am running CYGWIN 1.5.25 on Windows XP pack 2. I have a XWindows
graphics program that uses several XmOptionMenu widgets. The problem is
that whenever the user clicks frequently (sometimes a double-click is
enough) on these OptionMenu's the program crashes with a segmentation
error. This behaviour is not noticeable with the same program on HP-UX.

I reproduced the problem in the test program below. It seems as if the
combination of the WorkProc and the OptionMenu causes the problem. If I
remove the XtAppAddWorkProc statement there is no problem, but the only
widget that causes the crash is an OptionMenu (for example with a
PushButton I can't reproduce the crash).
Another thing I noticed is that when I reduce the number of microseconds
in the usleep command, I have to click faster to make the program crash.
It seems as if there is a relationship with how long the program is busy
in the WorkProc. In the actual program the usleep is replaced by
something useful of course.

Any help is appreciated.



#include <Xm/Xm.h>
#include <Xm/Form.h>
#include <Xm/PushB.h>

Boolean ViewerCheck()
  return False;

int main()
  Widget TopLevel,form,wdg1,wdg2,wdg3,wdg4;
  XtAppContext app;
  int argc=0;
  char *argv[1];

  TopLevel = XtVaAppInitialize(&app,"Test",NULL,0,&argc,argv,NULL,NULL);

  form = XtVaCreateManagedWidget( "Test",
    xmFormWidgetClass, TopLevel,
    XmNwidth, 100,
    XmNheight, 60);

  wdg1 = XmCreatePulldownMenu(form, "pulldown", NULL, 0);
  wdg2 = XtVaCreateManagedWidget("1", xmPushButtonWidgetClass, wdg1,
    XmNwidth, 60);
  wdg3 = XtVaCreateManagedWidget("2", xmPushButtonWidgetClass, wdg1,
    XmNwidth, 60);

  wdg4 = XmCreateOptionMenu(form, "TEST", NULL, 0);
  XtVaSetValues(wdg4, XmNsubMenuId, wdg1);

  XtAppAddWorkProc(app, (XtWorkProc) ViewerCheck, (XtPointer) NULL);

  return 0;

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

More information about the Cygwin-xfree mailing list