[orca] Fix for bug #640134 - Catch pyatspi2's RuntimeErrors



commit 96b325d394387b481d5af004291a6fdd6fb615dc
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 0c5a92f..b208357 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -604,10 +604,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
 
@@ -972,7 +972,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 2c2ad00..f7e6ae7 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]