[gnome-shell] Magnifier: demote exceptions reading focus/caret position



commit 6882273aa0ea8bfbe9c961e1a9f29d5ff71789d7
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Feb 13 16:12:59 2014 +0100

    Magnifier: demote exceptions reading focus/caret position
    
    It's possible that the DBus call goes in timeout (which is bad,
    but unavoidable, given that atspi is synchronous) or fails
    because the component has been removed (race condition). Those
    errors are not dependent on gnome-shell, but on faulty applications
    (mostly).
    If they happen, log a debug message and continue.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724305

 js/ui/magnifier.js |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 81e3553..b02b114 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -719,7 +719,14 @@ const ZoomRegion = new Lang.Class({
         let component = event.source.get_component_iface();
         if (!component || event.detail1 != 1)
             return;
-        let extents = component.get_extents(Atspi.CoordType.SCREEN);
+        let extents;
+        try {
+            extents = component.get_extents(Atspi.CoordType.SCREEN);
+        } catch(e) {
+            log('Failed to read extents of focused component: ' + e.message);
+            return;
+        }
+
         [this._xFocus, this._yFocus] = [extents.x + (extents.width / 2),
                                         extents.y + (extents.height / 2)];
         this._centerFromFocusPosition();
@@ -729,7 +736,14 @@ const ZoomRegion = new Lang.Class({
         let text = event.source.get_text_iface();
         if (!text)
             return;
-        let extents = text.get_character_extents(text.get_caret_offset(), 0);
+        let extents;
+        try {
+            extents = text.get_character_extents(text.get_caret_offset(), 0);
+        } catch(e) {
+            log('Failed to read extents of text caret: ' + e.message);
+            return;
+        }
+
         [this._xCaret, this._yCaret] = [extents.x, extents.y];
         this._centerFromCaretPosition();
     },


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