[orca/orca-gnome3: 81/87] Fix for bug #640134 - Catch pyatspi2's RuntimeErrors



commit be3a4c18d54c2150c47018a4786c4d8f63d29920
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Fri Mar 25 11:02:29 2011 -0400

    Fix for bug #640134 - Catch pyatspi2's RuntimeErrors

 src/orca/event_manager.py                 |    6 +++---
 src/orca/orca.py                          |    6 +++---
 src/orca/script_manager.py                |    2 +-
 src/orca/script_utilities.py              |    4 ++--
 src/orca/scripts/toolkits/Gecko/script.py |    2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index bd3d04c..f939d4b 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -438,7 +438,7 @@ class EventManager:
                     if settings.debugMemoryUsage:
                         orca.cleanupGarbage()
                     return
-            except LookupError:
+            except (LookupError, RuntimeError):
                 # If we got this error here, we'll get it again when we
                 # attempt to get the state, catch it, and clean up.
                 pass
@@ -458,9 +458,9 @@ class EventManager:
 
         try:
             state = event.source.getState()
-        except LookupError:
+        except (LookupError, RuntimeError):
             debug.println(debug.LEVEL_WARNING,
-                          "LookupError while processing event: %s" % eType)
+                          "Error while processing event: %s" % eType)
             if eType.startswith("window:deactivate"):
                 orca.setLocusOfFocus(event, None)
                 orca_state.activeWindow = None
diff --git a/src/orca/orca.py b/src/orca/orca.py
index c84c00b..fea6182 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -625,10 +625,10 @@ def setLocusOfFocus(event, obj, notifyScript=True, force=False):
         currentApp = orca_state.activeScript.app
         try:
             appList = [event.host_application, event.source.getApplication()]
-        except LookupError:
+        except (LookupError, RuntimeError):
             appList = []
             debug.println(debug.LEVEL_SEVERE,
-                           "orca.setLocusOfFocus() application LookupError")
+                           "orca.setLocusOfFocus() application Error")
         if not currentApp in appList:
             return
 
@@ -993,7 +993,7 @@ def keyEcho(event):
     #
     try:
         role = orca_state.locusOfFocus.getRole()
-    except LookupError:
+    except (LookupError, RuntimeError):
         debug.println(debug.LEVEL_SEVERE,
                       "orca.keyEcho() - locusOfFocus no longer exists")
         setLocusOfFocus(None, None, False)
diff --git a/src/orca/script_manager.py b/src/orca/script_manager.py
index 6809749..596ac71 100644
--- a/src/orca/script_manager.py
+++ b/src/orca/script_manager.py
@@ -111,7 +111,7 @@ class ScriptManager:
         if obj:
             try:
                 attributes = obj.getAttributes()
-            except LookupError:
+            except (LookupError, RuntimeError):
                 debug.println(debug.LEVEL_SEVERE,
                               "_toolkitForObject: %s no longer exists" % obj)
             else:
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c062c6c..0899589 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1107,9 +1107,9 @@ class Utilities:
         while not done:
             try:
                 relations = node.getRelationSet()
-            except LookupError:
+            except (LookupError, RuntimeError):
                 debug.println(debug.LEVEL_SEVERE,
-                              "nodeLevel() - LookupError getting RelationSet")
+                              "nodeLevel() - Error getting RelationSet")
                 return -1
             node = None
             for relation in relations:
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 06f3403..d62d96f 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -2820,7 +2820,7 @@ class Script(default.Script):
 
         try:
             state = obj.getState()
-        except LookupError:
+        except (LookupError, RuntimeError):
             debug.println(debug.LEVEL_SEVERE,
                           "isNavigableAria() - obj no longer exists")
             return True



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