[orca/gnome-3-36] Fix crash caused by author using aria-labelled by pointing to itself



commit 85599a4d2771fb287fe15947ce97ae07897ee5c5
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jun 9 10:11:42 2020 -0400

    Fix crash caused by author using aria-labelled by pointing to itself

 src/orca/braille_generator.py | 14 +++++---------
 src/orca/script_utilities.py  |  4 ++++
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 75490d8ce..b4b87ca32 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -394,15 +394,11 @@ class BrailleGenerator(generator.Generator):
         details.
         """
         result = []
-        try:
-            relations = obj.getRelationSet()
-        except:
-            relations = []
-        for relation in relations:
-            if relation.getRelationType() ==  pyatspi.RELATION_LABELLED_BY:
-                labelledBy = relation.getTarget(0)
-                result.extend(self.generate(labelledBy, **args))
-                break
+        labels = self._script.utilities.labelsForObject(obj)
+        for label in labels:
+            result.extend(self.generate(label, **args))
+            break
+
         if not result:
             # NOTE: there is no REAL_ROLE_SCROLL_PANE in formatting.py
             # because currently fallback to the default formatting.
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index a994b25f6..a861ccf80 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1693,6 +1693,10 @@ class Utilities:
 
         r = relations[0]
         result = set([r.getTarget(i) for i in range(r.getNTargets())])
+        if obj in result:
+            msg = 'WARNING: %s claims to be labelled by itself' % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            result.remove(obj)
 
         def isNotAncestor(acc):
             return not pyatspi.findAncestor(obj, lambda x: x == acc)


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