[orca/gnome-3-36] Handle more instances of objects going defunct on us
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-36] Handle more instances of objects going defunct on us
- Date: Wed, 1 Jul 2020 12:04:20 +0000 (UTC)
commit 1a2ea4c27465e19701ca3d6f3cfaef60364436b4
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jul 1 14:02:35 2020 +0200
Handle more instances of objects going defunct on us
src/orca/eventsynthesizer.py | 2 +-
src/orca/scripts/default.py | 3 ++-
src/orca/scripts/web/script.py | 3 +++
src/orca/scripts/web/script_utilities.py | 5 ++++-
src/orca/structural_navigation.py | 2 ++
5 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/eventsynthesizer.py b/src/orca/eventsynthesizer.py
index 98e2cc424..67fb36eed 100644
--- a/src/orca/eventsynthesizer.py
+++ b/src/orca/eventsynthesizer.py
@@ -237,7 +237,7 @@ def _scrollSubstringToLocation(obj, location, startOffset, endOffset):
debug.println(debug.LEVEL_INFO, msg, True)
return False
except:
- msg = "ERROR: Exception scrolling %s (%i,%i) to %s." % \
+ msg = "ERROR: Exception scrolling %s (%s,%s) to %s." % \
(obj, startOffset, endOffset, location)
debug.println(debug.LEVEL_INFO, msg, True)
return False
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 5f840d7ac..8e745585e 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -770,10 +770,11 @@ class Script(script.Script):
# gains focus, even though the caret has not actually moved.
try:
text = obj.queryText()
+ caretOffset = text.caretOffset
except:
pass
else:
- self._saveLastCursorPosition(obj, max(0, text.caretOffset))
+ self._saveLastCursorPosition(obj, max(0, caretOffset))
self.utilities.updateCachedTextSelection(obj)
# We want to save the current row and column of a newly focused
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index a9924d99c..72d445c4e 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -797,6 +797,9 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg, True)
return False
+ if prevObj and self.utilities.isDead(prevObj):
+ prevObj = None
+
if not _settingsManager.getSetting('caretNavTriggersFocusMode') \
and self._lastCommandWasCaretNav:
msg = "WEB: Not using focus mode due to caret nav settings"
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 958ef61da..0ee38b20a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -936,6 +936,9 @@ class Utilities(script_utilities.Utilities):
if not (obj and self.inDocumentContent(obj)) or self._script.browseModeIsSticky():
return super().queryNonEmptyText(obj)
+ if self.isDead(obj):
+ return None
+
if hash(obj) in self._text:
return self._text.get(hash(obj))
@@ -2538,7 +2541,7 @@ class Utilities(script_utilities.Utilities):
def filterContentsForPresentation(self, contents, inferLabels=False):
def _include(x):
obj, start, end, string = x
- if not obj:
+ if not obj or self.isDead(obj):
return False
rv = self._shouldFilter.get(hash(obj))
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 544b8ab12..b8f0d5412 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -952,6 +952,8 @@ class StructuralNavigation:
matches.reverse()
def _isValidMatch(obj):
+ if self._script.utilities.isDead(obj):
+ return False
if self._script.utilities.isHidden(obj) or self._script.utilities.isEmpty(obj):
return False
if not criteria.applyPredicate:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]