lock-up & crash while pulldown menu displayed and click elsewhere



I have been plagued by a hang and crash problem that requires me to
kill my program to unfreeze my display and input devices (mouse cursor
and keyboard).

I can easily reproduce it and it looks a lot like a problem previously
reported in two old posts ("Lock up bug - need advice" and "Event
Handler Hangs Motif Menus") but I can't figure out how to fix it.

I have a main window with a menubar across the top and lower in the
window I have some icons that you can select. If you select an icon
with the left-most mouse button, the icon becomes "selected". If you
select an icon with the right-most mouse button, a pop-up menu appears
for the icon that allows you to perform operations on the item
represented by the icon.

My problem happens when I am running in gdb and I select one of the
pulldown menus in the menubar then let up on the mouse button - the
pulldown remains displayed - then I move the mouse and right-click on
one of the icons. gdb displays:

Program received signal SIGSEGV, Segmentation fault
0x002ed748 in XtWidgetToApplicationContext()
(gdb)

and my entire display and all input devices lock up and my program has
to be killed from elsewhere to be able to unlock my display and input
devices.

I can't debug it since gdb hangs obviously but I log each of my
routines I enter and exit and can see that my icon's right-click event
handler is not getting logged, although it should be.

If I'm not running in gdb, I just crash with a Segmentation Fault and
don't hang.

I have no idea why this is crashing. Does anyone have any ideas?
Thanks in advance,
Julie

.