I'm wondering if a connect_while_alive() method would be useful in pygtk
2?  The connect_object() is often mentioned as a replacement method, but
it doesn't invalidate the handler until the object is collected by
Python's cyclic GC at some indeterminate time after the object is
destroyed.  This means that a handler can be invoked after the object
passed to connect_object() is destroyed and extra code needs to be added
to either check if the object is destroyed or signal disconnection needs
to be done manually.

We've been using connect_while_alive() with a signal system that mimics 
gtk 1's signals and have found it quite helpful to implement temporary 
handlers as methods on objects that can be destroyed -- it simplifies 
thinking about the object lifecycle to have a standard way of implementing 
temporary objects.  I want to move some of this code to classes derived 
from pygtk 2 objects and it would be easier with connect_while_alive() or 
some equivalent method.

John
_______________________________________________
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