[orca] Add sanity checks for dead LibreOffice windows



commit 393c8e220cc88ec4e7c56a843e9553cd394a8e1a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 18 16:48:44 2016 -0500

    Add sanity checks for dead LibreOffice windows

 src/orca/scripts/apps/soffice/script_utilities.py |    9 +++++++--
 src/orca/scripts/apps/soffice/spellcheck.py       |    4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index a0b51b9..510483c 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -480,8 +480,13 @@ class Utilities(script_utilities.Utilities):
         #
         if obj:
             topLevel = self.topLevelObject(obj)
-            if topLevel and not self.isZombie(topLevel) \
-               and topLevel.name.endswith("Impress"):
+            if not topLevel:
+                return False
+            if self.isDead(topLevel):
+                msg = "SOFFICE: Top level object %s is dead." % topLevel
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return False
+            if topLevel.name.endswith("Impress"):
                 return True
 
         return False
diff --git a/src/orca/scripts/apps/soffice/spellcheck.py b/src/orca/scripts/apps/soffice/spellcheck.py
index 4c95e34..307ce41 100644
--- a/src/orca/scripts/apps/soffice/spellcheck.py
+++ b/src/orca/scripts/apps/soffice/spellcheck.py
@@ -41,6 +41,10 @@ class SpellCheck(spellcheck.SpellCheck):
         super().__init__(script, hasChangeToEntry=False)
 
     def _isCandidateWindow(self, window):
+        if self._script.utilities.isDead(window):
+            msg = "SOFFICE: %s is not candidate window because it's dead." % window
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
         if window and window.childCount and window.getRole() == pyatspi.ROLE_FRAME:
             child = window[0]
             if child.getRole() == pyatspi.ROLE_DIALOG:


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