From: parente Date: Wed, 9 May 2007 18:42:05 +0000 (+0000) Subject: * registry.py: Fixed bug #436982 (Patch from Eitan), crash on exit X-Git-Tag: AT_SPI2_ATK_2_12_0~827 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86c482930c5191f70e4142a8eeeab2018cc6d022;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git * registry.py: Fixed bug #436982 (Patch from Eitan), crash on exit * utils.py: Fixed bug #437153, bad StateSet add/remove impl. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@922 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/pyatspi/ChangeLog b/pyatspi/ChangeLog index 33e6675..57ab829 100644 --- a/pyatspi/ChangeLog +++ b/pyatspi/ChangeLog @@ -1,3 +1,8 @@ +2007-05-09 Peter Parente + + * registry.py: Fixed bug #436982 (Patch from Eitan), crash on exit + * utils.py: Fixed bug #437153, bad StateSet add/remove impl. + 2007-05-08 Peter Parente * constants.py: diff --git a/pyatspi/registry.py b/pyatspi/registry.py index bc36134..f1eafdc 100644 --- a/pyatspi/registry.py +++ b/pyatspi/registry.py @@ -333,22 +333,35 @@ class Registry(object): ''' self.async = async - # register a signal handler for gracefully killing the loop - signal.signal(signal.SIGINT, self.stop) - signal.signal(signal.SIGTERM, self.stop) - if gil: def releaseGIL(): - time.sleep(1e-5) + try: + time.sleep(1e-5) + except KeyboardInterrupt, e: + # store the exception for later + releaseGIL.keyboard_exception = e + self.stop() return True + # make room for an exception if one occurs during the + releaseGIL.keyboard_exception = None i = gobject.idle_add(releaseGIL) # enter the main loop - bonobo.main() - - if gil: - gobject.source_remove(i) - + try: + bonobo.main() + except KeyboardInterrupt, e: + # re-raise the keyboard interrupt + raise e + finally: + # clear all observers + for name, ob in self.observers.items(): + ob.unregister(self.reg, name) + if gil: + gobject.source_remove(i) + if releaseGIL.keyboard_exception is not None: + # re-raise the keyboard interrupt we got during the GIL release + raise releaseGIL.keyboard_exception + def stop(self, *args): '''Quits the main loop.''' try: diff --git a/pyatspi/utils.py b/pyatspi/utils.py index a914375..7e825f3 100644 --- a/pyatspi/utils.py +++ b/pyatspi/utils.py @@ -341,7 +341,7 @@ class StateSet(Accessibility__POA.StateSet): @param state: State(s) to add @type state: Accessibility.StateType ''' - self.states.add(state) + map(self.states.add, state) def remove(self, *state): ''' @@ -350,7 +350,7 @@ class StateSet(Accessibility__POA.StateSet): @param state: State(s) to remove @type state: Accessibility.StateType ''' - self.states.remove(state) + map(self.states.remove, state) def equals(self, state_set): '''