Apply my suggested patch from #4368. Fixes #4368.

This commit is contained in:
js 2008-10-03 13:56:36 +00:00
parent f321d52d24
commit b4e30ff003
1 changed files with 9 additions and 1 deletions

View File

@ -435,11 +435,19 @@ class GlibIdleQueue(idlequeue.IdleQueue):
''' this method is called when we plug a new idle object.
Start listening for events from fd
'''
res = gobject.io_add_watch(fd, flags, self.process_events,
res = gobject.io_add_watch(fd, flags, self._process_events,
priority=gobject.PRIORITY_LOW)
# store the id of the watch, so that we can remove it on unplug
self.events[fd] = res
def _process_events(self, fd, flags):
try:
return self.process_events(fd, flags)
except:
self.remove_idle(fd)
self.add_idle(fd, flags)
raise
def remove_idle(self, fd):
''' this method is called when we unplug a new idle object.
Stop listening for events from fd