[orca] Handle yet another instance of an object going defunct on us



commit a6845004789c0daa6e96f0e5669622ea0d2b22cd
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Apr 28 10:46:45 2020 -0400

    Handle yet another instance of an object going defunct on us
    
    Turns out an object can be alive when we query its text interface,
    but dead when we then immediately ask for its character count.

 src/orca/script_utilities.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 1ed090286..150ea87ec 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2892,10 +2892,14 @@ class Utilities:
 
         try:
             text = obj.queryText()
-        except:
+            charCount = text.characterCount
+        except NotImplementedError:
             pass
+        except:
+            msg = "ERROR: Exception getting character count of %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
         else:
-            if text.characterCount:
+            if charCount:
                 return text
 
         return None


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