Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: fwr@switch.com (Frank W. Radish)
Subject: XtDestroyWidget and XtAppAddTimeout bug on DEC platforms
Date: Mon, 28 Jun 1993 19:30:35 GMT	[thread overview]
Message-ID: <C9CJIz.I5D@switch.com> (raw)

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 <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/RowColumn.h>
}

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 );
}


                 reply	other threads:[~1993-06-28 19:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox