[orca] Gracefully handle AT-SPI2 timeout when checking validity of app



commit 3b1d792c7ec992b7cec8456581ef9ee01263cce1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri May 22 11:43:16 2020 -0400

    Gracefully handle AT-SPI2 timeout when checking validity of app

 src/orca/script_manager.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_manager.py b/src/orca/script_manager.py
index 1a9d77fa1..f01654705 100644
--- a/src/orca/script_manager.py
+++ b/src/orca/script_manager.py
@@ -342,15 +342,25 @@ class ScriptManager:
             try:
                 return app.get_process_id()
             except:
+                msg = "SCRIPT MANAGER: Exception getting pid for %s" % app
+                debug.println(debug.LEVEL_INFO, msg, True)
                 return -1
 
+        def _isValidApp(app):
+            try:
+                return a in self._desktop
+            except:
+                msg = "SCRIPT MANAGER: Exception seeing if %s is in desktop" % app
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return False
+
         pid = _pid(app)
         if pid == -1:
             return None
 
         items = self.appScripts.items()
         for a, script in items:
-            if a != app and _pid(a) == pid and a in self._desktop:
+            if a != app and _pid(a) == pid and _isValidApp(a):
                 return script
 
         return None


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