[orca] Handle more cases of LO objects becoming defunct



commit 49c77d1da7515d1bbef4faef9567988ded359468
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jan 24 10:44:05 2017 +0100

    Handle more cases of LO objects becoming defunct

 src/orca/scripts/apps/soffice/script_utilities.py |   32 +++++++++++++++------
 1 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index 308605d..0e9413e 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -241,17 +241,31 @@ class Utilities(script_utilities.Utilities):
         try:
             role = obj.getRole()
             childCount = obj.childCount
+            name = obj.name
         except:
-            role = None
-            childCount = 0
+            msg = "SOFFICE: Exception getting properties of %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
 
-        if role == pyatspi.ROLE_PANEL and childCount == 1:
-            if obj.name and obj.name == obj[0].name:
-                return True
+        if role == pyatspi.ROLE_PANEL and childCount == 1 and name:
+            try:
+                child = obj[0]
+            except:
+                msg = "SOFFICE: Exception getting child of %s" % obj
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                if child and child.name == name:
+                    return True
 
-        if role == pyatspi.ROLE_LIST \
-           and obj.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
-            return True
+        if role == pyatspi.ROLE_LIST:
+            try:
+                parentRole = obj.parent.getRole()
+            except:
+                msg = "SOFFICE: Exception getting parent role of %s" % obj
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                if parentRole == pyatspi.ROLE_COMBO_BOX:
+                    return True
 
         return super().isLayoutOnly(obj)
 


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