On 08.10.2009 20:57, Steve Borho wrote: > FYI > > I realized today that we need to explicitly 'return False' from all of > our idle_add() callback routines. > If the return result evaluates as True, the callback will be called > endlessly.
Ah. I think I found an especially funny case: gtk.Widget.destroy() is called for example in hgtk/guess.py like this: <snip> class DetectRenameDialog(gtk.Window): 'Detect renames after they occur' def __init__(self): 'Initialize the Dialog' gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtklib.set_tortoise_icon(self, 'detect_rename.ico') gtklib.set_tortoise_keys(self) try: repo = hg.repository(ui.ui(), path=paths.find_root()) except hglib.RepoError: gobject.idle_add(self.destroy) <----- return </snip> The function gtk.Widget.destroy() is implemented in gtk itself, obviously. Unless we override that (which DetectRenameDialog does not), we can't even control what destroy returns. Now, assume that gtk.Widget.destroy() some day decides to return True in some cases. This would be truly funny :) The spec doesn't guarantee that this function returns None or False: http://www.pygtk.org/pygtk2reference/class-gtkwidget.html#method-gtkwidget--destroy If it some day starts returning the number of objects it has already destroyed since midnight, then that number counts as True for non-zero values and "gobject.idle_add(self.destroy)" will happily call it again. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop