XForms: popup menu causes crash

Dick Middleton (dick@sqf.hp.com)
Fri, 16 May 1997 13:19:59 +0100

To subscribers of the xforms list from Dick Middleton <dick@sqf.hp.com> :

> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> > I'm having some difficulty with popup menus. I don't know whether
> > it's my programming error or a bug. It would be nice if an expert could look
> > at it.
> >
> > I copied bits from the demo program pup to make this. What I find is if the
> > form with the menu:
> >
> > is shown
> > menu selected
> > form hidden
> > form shown again
> > menu selected again
> >
> > then the program terminates with BadDrawable in X_GetGeometry:

> The problem is that when you hide a Form, XForms destroys the Window
> and all the associated resources connected to it, so when you fire off
> your menu for the second time, it's looking at resources that no
> longer exist. Move the menu create stuff into the callback.

> My tack in dealing with menus and other transient objects of that
> nature is to create them on the fly (it's very quick) and then destroy
> them as soon as they've popped down. I generally don't even create
> them until the Menu button is actually pressed. I've not had the need
> to do this with cascaded menus but I don't see any reason why this
> approach wouldn't work in that case as well.

Thanks again for your help and insight.

Dick

--

dick@sqf.hp.com _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/