From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,c9d1fa6e6451a4e6,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-06-21 05:41:08 PST Newsgroups: comp.sys.dec Path: gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!fs7.ece.cmu.edu!uss.switch.com!fwr From: fwr@switch.com (Frank W. Radish) Subject: X TimeOuts and Motif Menu Popups on DEC platforms Message-ID: Keywords: XtAppAddTimeOut, Popups, XtDestroy Sender: news@switch.com (USENET News System) Organization: Union Switch and Signal Inc. Date: Mon, 21 Jun 1993 12:29:05 GMT I have been having some problems with timeouts and menu popups on DEC platforms. It seems if I create a menu popup (w/ XmCreatePopupMenu) for a window, popup the menu a few times and then destroy the top level shell for that window any timeouts that I've added with XtAppAddTimeOut disappear. I have produced a testcase that seems to have the minimum amount of code that still causes the problem. I should also add that it doesn't always happen when deleting the first window, so I've created 5. To reproduce the error: NOTE: Be sure your environmental variable DISPLAY is defined. 1) Run the test program. (notice that I just put a printf in my timeout) 2) Once all 5 screens are mapped, use either the left or right mouse buttons to click around in the screen (the popup won't be mapped because I left out the code to do this, however it doesn't seem to matter) 3) Using the Mwm option menu to close each window until you see the timer stop executing. Has anyone else seen this problem?? The DEC platforms where I have tested this and am having problems are the DECstation 5000/133 running Ultrix for mips and the DEC Alpha workstation running OSF/1. In each case we are using X11R4 and Motif 1.1. I'm also compiling with C++ but this also doesn't seem to be affecting anything. (I just removed any C++ references and recompiled with the same results...) I'd appreciate any help I can get. Frank Radish (412) 369-2768 ====================== Example Code ======================================= extern "C" { #include #include #include #include #include #include #include #include } XtAppContext app; int TIMER_PERIOD = 500; void X_timer_rtn( XtPointer, XtIntervalId *) { static int count = 0; printf("In X timer routine count = %d\n", count++ ); XtAppAddTimeOut( app, TIMER_PERIOD, (XtTimerCallbackProc)X_timer_rtn, (XtPointer)NULL ); } main( int argc, String *argv ) { Widget toplevel; if ( argc > 1 ) { TIMER_PERIOD = atol( argv[1] ); } XtToolkitInitialize(); app = XtCreateApplicationContext(); Display *_dsp; int ac, i; Arg al[10]; #ifdef AlphaArchitecture _dsp = XtOpenDisplay( app, "", "testApp", "TestApp", NULL, 0, &argc, argv); #else unsigned int tmp_argc = argc; _dsp = XtOpenDisplay( app, "", "testApp", "TestApp", NULL, 0, &tmp_argc, argv); #endif printf(" _dsp = %x\n", _dsp ); if ( _dsp != (Display *)NULL) { toplevel = XtAppCreateShell("testApp" , "TestApp", applicationShellWidgetClass, _dsp, NULL, 0); XtAppAddTimeOut( app, TIMER_PERIOD, (XtTimerCallbackProc)X_timer_rtn, (XtPointer)NULL ); } for (i=0; i<5; i++ ) if ( _dsp != (Display *)NULL) // XtOpenDisplay was successful { Widget shell; ac = 0; XtSetArg(al[ac], XmNwidth, 700); ac++; XtSetArg(al[ac], XmNheight, 500); ac++; shell = XtCreateManagedWidget( "Shell", topLevelShellWidgetClass, toplevel, al, ac ); Widget screenPU; ac = 0; screenPU = XmCreatePopupMenu(shell, "screenDefaultPU", al, ac); XtPopup( shell, XtGrabNone ); } XtAppMainLoop( app ); }