[orca] Handle exception when object is destroyed while getting text attributes



commit 2dc02f6751cb6a9a06290ece5f3c0a03e3e3fcb0
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jan 17 15:35:52 2022 +0100

    Handle exception when object is destroyed while getting text attributes

 src/orca/script_utilities.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index d02f27238..48aa41712 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -3163,9 +3163,14 @@ class Utilities:
         rv = []
         offset = startOffset
         while offset < endOffset:
-            attrList, start, end = text.getAttributeRun(offset)
-            msg = "INFO: Attributes at %i: %s (%i-%i)" % (offset, attrList, start, end)
-            debug.println(debug.LEVEL_INFO, msg, True)
+            try:
+                attrList, start, end = text.getAttributeRun(offset)
+                msg = "INFO: Attributes at %i: %s (%i-%i)" % (offset, attrList, start, end)
+                debug.println(debug.LEVEL_INFO, msg, True)
+            except:
+                msg = "ERROR: Exception getting attributes at %i" % (offset)
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return rv
 
             attrDict = dict([attr.split(':', 1) for attr in attrList])
             rv.append((max(start, offset), end, attrDict))


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