[orca] LibreOffice: Don't update locusOfFocus to dead object



commit 9063d74266ddc84dfafd217a96b42e2c2618a40c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Aug 12 14:43:29 2021 +0200

    LibreOffice: Don't update locusOfFocus to dead object
    
    In LibreOffice, when we get a text-selection-changed event from an
    object which claims to be focused but is not the locusOfFocus, we
    update the locusOfFocus before passing the event onto the default
    script. We do this because LibreOffice isn't super reliable about
    emitting focus events, and the default script will ignore the event
    otherwise.
    
    Unfortunately, Calc is emitting text-selection-changed on a destroyed
    object which claims to be focused. Therefore, check if this object is
    dead and return early if it is.

 src/orca/scripts/apps/soffice/script.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index f3617799f..14ac34790 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -915,6 +915,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return
 
+        if self.utilities.isDead(event.source):
+            msg = "SOFFICE: Ignoring event from dead source."
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return
+
         if event.source != orca_state.locusOfFocus \
            and event.source.getState().contains(pyatspi.STATE_FOCUSED):
             orca.setLocusOfFocus(event, event.source, False)


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