[orca] Fix (I hope) for bug #640132 - Orca sometimes becomes non-responsive after an app is quit



commit 52ec5760581d48d0ab88903864a05178a89a1bbd
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Jan 20 23:05:43 2011 -0500

    Fix (I hope) for bug #640132 - Orca sometimes becomes non-responsive after an app is quit

 src/orca/debug.py                              |    2 ++
 src/orca/event_manager.py                      |    8 +++++++-
 src/orca/scripts/apps/gnome-terminal/script.py |    3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/debug.py b/src/orca/debug.py
index 39e3387..d11004f 100644
--- a/src/orca/debug.py
+++ b/src/orca/debug.py
@@ -235,6 +235,7 @@ def getAccessibleDetails(level, acc, indent="", includeApp=True):
         states = stateSet.getStates()
     except:
         string += "(exception getting states)"
+        states = []
     state_strings = []
     for state in states:
         state_strings.append(pyatspi.stateToString(state))
@@ -245,6 +246,7 @@ def getAccessibleDetails(level, acc, indent="", includeApp=True):
         relations = acc.getRelationSet()
     except:
         string += "(exception getting relation set)"
+        relations = None
     if relations:
         relation_strings = []
         for relation in relations:
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index be7dc60..43e03b8 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -303,7 +303,13 @@ class EventManager:
         - eventType: the event type.
         """
 
-        self._listenerCounts[eventType] -= 1
+        try:
+            self._listenerCounts[eventType] -= 1
+        except KeyError:
+            debug.println(debug.LEVEL_SEVERE,
+                          "KeyError deregistering %s listener" % eventType)
+            return
+
         if self._listenerCounts[eventType] == 0:
             self.registry.deregisterEventListener(self._enqueue, eventType)
             del self._listenerCounts[eventType]
diff --git a/src/orca/scripts/apps/gnome-terminal/script.py b/src/orca/scripts/apps/gnome-terminal/script.py
index b7c2993..73b1e79 100644
--- a/src/orca/scripts/apps/gnome-terminal/script.py
+++ b/src/orca/scripts/apps/gnome-terminal/script.py
@@ -98,7 +98,8 @@ class Script(default.Script):
         if newLocusOfFocus and \
            newLocusOfFocus.getRole() == pyatspi.ROLE_TERMINAL:
             pageTab = event.source.parent.parent.parent
-            if oldLocusOfFocus.getRole() == pyatspi.ROLE_TERMINAL and \
+            if oldLocusOfFocus \
+               and oldLocusOfFocus.getRole() == pyatspi.ROLE_TERMINAL and \
                pageTab.getRole() == pyatspi.ROLE_PAGE_TAB and \
                pageTab.getState().contains(pyatspi.STATE_SENSITIVE):
                 self.updateBraille(newLocusOfFocus)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]