[orca] Add more sanity checks for defunct objects
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add more sanity checks for defunct objects
- Date: Mon, 30 Nov 2015 20:31:35 +0000 (UTC)
commit 18b15ff4d7a12d25fa667bb52dd82feeb6850dd4
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Nov 30 15:29:36 2015 -0500
Add more sanity checks for defunct objects
src/orca/script_utilities.py | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 0249771..fb0b2a5 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -976,7 +976,17 @@ class Utilities:
return self.getContainingDocument(obj) is None
def isSpreadSheetTable(self, obj):
- if not (obj and obj.getRole() == pyatspi.ROLE_TABLE):
+ if not obj:
+ return False
+
+ try:
+ role = obj.getRole()
+ except:
+ msg = 'ERROR: Exception getting role of %s' % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
+ if not role == pyatspi.ROLE_TABLE:
return False
doc = self.getContainingDocument(obj)
@@ -1000,19 +1010,39 @@ class Utilities:
return False
def isTextDocumentCell(self, obj):
+ if not obj:
+ return False
+
+ try:
+ role = obj.getRole()
+ except:
+ msg = 'ERROR: Exception getting role of %s' % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
cellRoles = [pyatspi.ROLE_TABLE_CELL,
pyatspi.ROLE_COLUMN_HEADER,
pyatspi.ROLE_ROW_HEADER]
- if not (obj and obj.getRole() in cellRoles):
+ if not role in cellRoles:
return False
return pyatspi.findAncestor(obj, self.isTextDocumentTable)
def isSpreadSheetCell(self, obj):
+ if not obj:
+ return False
+
+ try:
+ role = obj.getRole()
+ except:
+ msg = 'ERROR: Exception getting role of %s' % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
cellRoles = [pyatspi.ROLE_TABLE_CELL,
pyatspi.ROLE_COLUMN_HEADER,
pyatspi.ROLE_ROW_HEADER]
- if not (obj and obj.getRole() in cellRoles):
+ if not role in cellRoles:
return False
return pyatspi.findAncestor(obj, self.isSpreadSheetTable)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]