[orca/introspection] Temporary hack-around for the reliably-segfaulting pygobject bug 657120.



commit b17abde4489d43c4f7505ec2df1c12d99825780b
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Aug 22 19:41:20 2011 -0400

    Temporary hack-around for the reliably-segfaulting pygobject bug 657120.
    
    The segfault in question reliably and constantly hangs Orca, making
    it impossible to continue working on the introspection port. This is
    an interim work-around whose side effect is that Orca cannot process
    its own key commands or examine key events as part of the heuristic
    work it must sometimes do.
    
    RELATED: To ensure we don't forget this and accidentally commit it
    to master, it spews out a warning every time the call is bypassed.
    As a result, you really do NOT want to launch Orca from an accessible
    terminal (e.g. gnome-terminal) due to the sheer number of text-changed
    events you'll get from the warnings. Instead prefer launching Orca from
    something inaccessible like xterm. You have been warned. ;-)

 src/orca/keybindings.py                            |   34 ++++++++++++++++++-
 src/orca/scripts/toolkits/CALLY/script.py          |   17 +++++++++-
 .../scripts/toolkits/J2SE-access-bridge/script.py  |   17 +++++++++-
 3 files changed, 64 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/keybindings.py b/src/orca/keybindings.py
index 61de230..2b9a74e 100644
--- a/src/orca/keybindings.py
+++ b/src/orca/keybindings.py
@@ -60,7 +60,22 @@ def getAllKeysyms(keysym):
             # level]).
             #
             keymap = Gdk.Keymap.get_default()
-            entries = keymap.get_entries_for_keyval(keyval)
+
+            # TODO - TODO - DO NOT COMMIT THIS TO MASTER!!! - TODO - TODO
+            # Right now get_entries_for_keyval() segfaults. See bgo 657120.
+            # We cannot work on the Orca introspection port if Orca hangs
+            # every time we press a key. So for now, disable the offending
+            # calls. This means, that all Orca cannot process its own key
+            # commands or examine key events as part of the heuristic work
+            # it must sometimes do. :-(
+            #
+            # success, entries = keymap.get_entries_for_keyval(keyval)
+            #
+            print 'WARNING: Call to get_entries_for_keyval() disabled'
+            return _keysymsCache[keysym]
+            # TODO: When bgo 657120 is fixed, re-enable the call to
+            # get_entries_for_keyval() and nuke the above two lines.
+
             keycode = 0
             if entries:
                 for entry in entries:
@@ -125,7 +140,22 @@ def getKeycode(keysym):
         # entry is of the form [keycode, group, level]).
         #
         _keycodeCache[keysym] = 0
-        success, entries = keymap.get_entries_for_keyval(keyval)
+
+        # TODO - TODO - DO NOT COMMIT THIS TO MASTER!!! - TODO - TODO
+        # Right now get_entries_for_keyval() segfaults. See bgo 657120.
+        # We cannot work on the Orca introspection port if Orca hangs
+        # every time we press a key. So for now, disable the offending
+        # calls. This means, that all Orca cannot process its own key
+        # commands or examine key events as part of the heuristic work
+        # it must sometimes do. :-(
+        #
+        # success, entries = keymap.get_entries_for_keyval(keyval)
+        #
+        print 'WARNING: Call to get_entries_for_keyval() disabled'
+        return _keycodeCache[keysym]
+        # TODO: When bgo 657120 is fixed, re-enable the call to
+        # get_entries_for_keyval() and nuke the above two lines.
+
         for entry in entries:
             if entry.group == 0:
                 _keycodeCache[keysym] = entry.keycode
diff --git a/src/orca/scripts/toolkits/CALLY/script.py b/src/orca/scripts/toolkits/CALLY/script.py
index 4757d51..e30f5af 100644
--- a/src/orca/scripts/toolkits/CALLY/script.py
+++ b/src/orca/scripts/toolkits/CALLY/script.py
@@ -139,7 +139,22 @@ class Script(default.Script):
             keymap = Gdk.Keymap.get_default()
 
             if keymap:
-                success, entries = keymap.get_entries_for_keyval(keyval)
+
+                # TODO - TODO - DO NOT COMMIT THIS TO MASTER!!! - TODO - TODO
+                # Right now get_entries_for_keyval() segfaults. See bgo 657120.
+                # We cannot work on the Orca introspection port if Orca hangs
+                # every time we press a key. So for now, disable the offending
+                # calls. This means, that all Orca cannot process its own key
+                # commands or examime key events as part of the heuristic work
+                # it must sometimes do. :-(
+                #
+                # success, entries = keymap.get_entries_for_keyval(keyval)
+                #
+                print 'WARNING: Call to get_entries_for_keyval() disabled'
+                return default.Script.checkKeyboardEventData(self, keyboardEvent)
+                # TODO: When bgo 657120 is fixed, re-enable the call to
+                # get_entries_for_keyval() and nuke the above two lines.
+
                 group = entries[0].group
 
                 keyval, egroup, level, consumed = \
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
index 0138b2a..9ad7043 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
@@ -95,7 +95,22 @@ class Script(default.Script):
 
         keymap = Gdk.Keymap.get_default()
         keyval = Gdk.keyval_from_name(keyboardEvent.keyval_name)
-        success, entries = keymap.get_entries_for_keyval(keyval)
+
+        # TODO - TODO - DO NOT COMMIT THIS TO MASTER!!! - TODO - TODO
+        # Right now get_entries_for_keyval() segfaults. See bgo 657120.
+        # We cannot work on the Orca introspection port if Orca hangs
+        # every time we press a key. So for now, disable the offending
+        # calls. This means, that all Orca cannot process its own key
+        # commands or examine key events as part of the heuristic work
+        # it must sometimes do. :-(
+        #
+        # success, entries = keymap.get_entries_for_keyval(keyval)
+        #
+        print 'WARNING: Call to get_entries_for_keyval() disabled'
+        success, entries = False, []
+        # TODO: When bgo 657120 is fixed, re-enable the call to
+        # get_entries_for_keyval() and nuke the above two lines.
+
         for entry in entries:
             if entry.group == 0:
                 keyboardEvent.hw_code = entry.keycode



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