[orca] Prevent infinite recursion generating statusbar content



commit 6cf4b47f070959c44a0968f720703ad9b33a4a22
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Mar 8 10:42:04 2021 +0100

    Prevent infinite recursion generating statusbar content
    
    It appears that sometimes we're getting the status bar itself as part
    of the status bar's items (or perhaps the status bar has a descendant
    status bar??). This can lead to infinite recursion. Therefore, filter
    out any status bars returned when we get the status bar's items. Also
    add a redundant check to the speech generator to ensure we avoid this
    problem.

 src/orca/script_utilities.py | 3 ++-
 src/orca/speech_generator.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index f3fad0a9d..eddc51380 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2257,7 +2257,8 @@ class Utilities:
         start = time.time()
         items = self._script.pointOfReference.get('statusBarItems')
         if not items:
-            items = self.getOnScreenObjects(obj)
+            include = lambda x: x and x.getRole() != pyatspi.ROLE_STATUS_BAR
+            items = list(filter(include, self.getOnScreenObjects(obj)))
             self._script.pointOfReference['statusBarItems'] = items
 
         end = time.time()
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 50622736f..6de2c3eaf 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2399,6 +2399,9 @@ class SpeechGenerator(generator.Generator):
 
         result = []
         for child in items:
+            if child == statusBar:
+                continue
+
             childResult = self.generate(child, includeContext=False)
             if childResult:
                 result.extend(childResult)


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