Hi,
   I recently tracked down a bug in my gtk/python app.  The cause is
that one of the GTK signal handlers I have is being invoked in
a reentrant manner.  I'm unsure what the best/proper way to deal
with this is.

Here's a quick description of what's going on.  I have a handler
for button click events.  When a button click is received, I
construct a GtkMenu and pop it up for the user to select something.
The menu has items in it that connect to callback functions when
selected.  Now what is happening is that if the user clicks several
times rapidly, the menu items show up and the user can rapidly
select two menu items.  When the function for handling this selection
is invoked, it must do something internally which allows gtk to
process some more signals, because the same handler is then invoked
again before it is finished handling the first selection.

My question is.. what is the "right" way, or at least a good way
of handling this in GTK and PyGTK in particular?  Since I am
using context menus in a number of places in a similar fashion
I fear there may be other race conditions like this in my code.
I would like to have a good mechanism for serializing the use
of the context menu.  I think one solution would be if all other
gtk interactions were disabled while a context menu was active
(if this isnt already the case).  Would that work or would I just
be making the race smaller?

Tim N.

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to