[accerciser: 1/2] Catch exceptions related to accessing the accessibleId property



commit f155d3a5100b09453df76f3de75708256a565d9d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jul 5 12:08:57 2019 -0400

    Catch exceptions related to accessing the accessibleId property
    
    It is possible for an application to be built locally using different
    versions of dependencies than those of the system. As a result, we can
    encounter the condition where accessibleId is amongst the properties of
    the accessible object, but attempting to retrieve the value of that
    property results in an error. Should that occur, Accerciser's Interface
    Viewer stops populating and cannot be used to obtain even the most
    basic details of the accessible object. It's safer to just catch all
    errors and display '(no ID)' regardless of the source of failure.

 plugins/interface_view.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/interface_view.py b/plugins/interface_view.py
index e364a99..90409d1 100644
--- a/plugins/interface_view.py
+++ b/plugins/interface_view.py
@@ -341,9 +341,9 @@ class _SectionAccessible(_InterfaceSection):
 
     self.child_count_label.set_text(str(acc.childCount))
     self.desc_label.set_label(acc.description or _('(no description)'))
-    if 'accessibleId' in dir(acc) and acc.accessibleId:
+    try:
         self.id_label.set_label(acc.accessibleId)
-    else:
+    except:
         self.id_label.set_label(_('(no ID)'))
 
     states = [pyatspi.stateToString(s) for s in acc.getState().getStates()]


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