[orca] Make our new _findAllDescendants() more robust against defunct objects
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Make our new _findAllDescendants() more robust against defunct objects
- Date: Wed, 21 Nov 2018 15:11:53 +0000 (UTC)
commit 223894fe39cd537dc9962ba10fbcf0e5dbd4809e
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Nov 21 10:09:30 2018 -0500
Make our new _findAllDescendants() more robust against defunct objects
* Return early if we cannot obtain the root's childCount
* Return early if we cannot get a particular child
src/orca/script_utilities.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 76283bc34..7b8be9116 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2284,7 +2284,21 @@ class Utilities:
return not (extents.width and extents.height)
def _findAllDescendants(self, root, includeIf, excludeIf, matches):
- for child in root:
+ try:
+ childCount = root.childCount
+ except:
+ msg = "ERROR: Exception getting childCount for %s" % root
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return
+
+ for i in range(childCount):
+ try:
+ child = root[i]
+ except:
+ msg = "ERROR: Exception getting %i child for %s" % (i, root)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return
+
if excludeIf and excludeIf(child):
continue
if includeIf and includeIf(child):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]