From: eitani Date: Thu, 25 Oct 2007 16:58:12 +0000 (+0000) Subject: * event.py (Event.__init__): Catch AttributeError when ref()ing X-Git-Tag: AT_SPI2_ATK_0_1_3~338 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90f4cb34f907b12ac5716704a578537bb3db5503;p=platform%2Fupstream%2Fat-spi2-atk.git * event.py (Event.__init__): Catch AttributeError when ref()ing event.source (bug #490205). * accessible.py (_makeExceptionHandler._inner): If return value is a CORBA object, ref() it (bug #490202). git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@959 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/pyatspi/ChangeLog b/pyatspi/ChangeLog index 730ab56..b558cd0 100644 --- a/pyatspi/ChangeLog +++ b/pyatspi/ChangeLog @@ -1,3 +1,10 @@ +2007-10-25 Eitan Isaacson + + * event.py (Event.__init__): Catch AttributeError when ref()ing + event.source (bug #490205). + * accessible.py (_makeExceptionHandler._inner): If return value is + a CORBA object, ref() it (bug #490202). + 2007-10-22 Eitan Isaacson * accessible.py (_RelationMixin.getTarget): Add a ref() to the diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py index 5aadb9e..433d05b 100644 --- a/pyatspi/accessible.py +++ b/pyatspi/accessible.py @@ -183,7 +183,9 @@ def _makeExceptionHandler(func): def _inner(self, *args, **kwargs): try: # try calling the original func - return func(self, *args, **kwargs) + rv = func(self, *args, **kwargs) + if isinstance(rv, ORBit.CORBA.Object): rv.ref() + return rv except ORBit.CORBA.NO_IMPLEMENT, e: # raise Python exception raise NotImplementedError(e) diff --git a/pyatspi/event.py b/pyatspi/event.py index da97120..bc230f2 100644 --- a/pyatspi/event.py +++ b/pyatspi/event.py @@ -140,8 +140,11 @@ class Event(object): # store the event source and increase the reference count since event # sources are borrowed references; the AccessibleMixin automatically # decrements it later + try: + event.source.ref() + except AttributeError: + pass self.source = event.source - self.source.ref() # process any_data in a at-spi version independent manner details = event.any_data.value()