GNOME Bugzilla – Bug 652500
DBusException seen when Orca is running with gnome-shell mag
Last modified: 2011-06-24 21:18:34 UTC
Environment: * Kubuntu Oneiric * GNOME 3 from the Ubuntu GNOME 3 team * Orca from current (now gnome-3-based) master * gnome-shell mag launched via Universal Access Settings Step to Reproduce: 1. Press Alt+F1 and start typing. Results: 1. Orca+gsmag fails to present the text/entry or selection changes. 2. Desktop seems to hang. But if you wait long enough it comes back. Traceback (most recent call last):
+ Trace 227465
self._processObjectEvent(event)
script.processObjectEvent(event)
self.listeners[key](event)
default.Script.onStateChanged(self, event)
self.onFocus(event)
orca.setLocusOfFocus(event, newFocus)
event, oldLocusOfFocus, orca_state.locusOfFocus)
mag.magnifyAccessible(event, newLocusOfFocus)
_setROICursorPush(x, y, width, height)
[roiLeft, roiTop, roiRight, roiBottom] = _zoomer.getRoi()
**keywords)
message, timeout)
As I said on IRC, my gut says this is because the DBus calls should be asynchronous. Python offers both a synchronous and an asynchronous interface; and, gsmag.py uses the synchronous one. To test that hunch, I put together a quick and dirty change, making one of the calls asynchronous, and the desktop "freeze" has vanished. I'll flesh this out fully, next, and test it thoroughly. Feel free to assign this bug to me, if you like. FYI: http://smcv.pseudorandom.co.uk/2008/11/nonblocking/ -- a warning against using python's synchronous DBus interface.
Props to your gut. My gut is not worthy. ;-) And I would love to assign this bug to you. Thanks Joseph!!
Created attachment 190147 [details] [review] Patch to make D-Bus calls asynchronous In addition to making the relevant D-Bus calls asynchronous, I noticed that the "_zoomer" was not properly configured as a D-Bus interface object (makes me wonder why this worked at all). I fixed that too.
Review of attachment 190147 [details] [review]: Works for me. Thanks! A few nits, some more anal-retentive than others. + _setROICenter(self.centerX, self.centerY); Old habit die hard. :-P (Please drop the semicolon.) + rightOfROI = (self.left + self.width + self.edgeMarginX) >= (roiLeft + roiWidth) + aboveROI = (self.top - self.edgeMarginY) <= roiTop + belowROI = (self.top + self.height + self.edgeMarginY) >= (roiTop + roiHeight) Please wrap lines which exceed 80 chars. +def _dbusCallbackError(funcName, error): + """Log D-Bus errors + + Arguments: + - funcName: The name of the gsmag function that made the D-Bus call. + - error: The error that D-Bus returned. + """ + logLine = funcName + ' failed: ' + str(error) + log.info(logLine) log.info? Using Orca's debug utilities would be helpful. @@ -481,7 +555,7 @@ def setMagnifierCrossHair(enabled, updateScreen=True): if enabled: size = settings.magCrossHairSize - _magnifier.setCrosswireSize(size) + _magnifier.setCrosswireSize(size, ignore_reply=True) _magSettings.set_boolean(CROSSHAIRS_SHOW_KEY, enabled) Ok, but... If Orca is no longer going to be controlling the magnifier preferences, would it make more sense just to remove that call? def setMagnifierCrossHairClip(enabled, updateScreen=True): @@ -495,7 +569,7 @@ def setMagnifierCrossHairClip(enabled, updateScreen=True): if not _initialized: return - _magnifier.setCrosswireClip(enabled) + _magnifier.setCrosswireClip(enabled, ignore_reply=True) Ditto. def setMagnifierObjectColor(magProperty, colorSetting, updateScreen=True): """Sets the specified zoomer property to the specified color. @@ -524,7 +598,8 @@ def setMagnifierObjectColor(magProperty, colorSetting, updateScreen=True): # Shift left 8 bits to put in alpha value. if magProperty == 'crosswire-color': crossWireColor = int(colorString, 16) - _magnifier.setCrosswireColor(crossWireColor & 0xffffffff) + _magnifier.setCrosswireColor(crossWireColor & 0xffffffff, + ignore_reply=True) Ditto. # [[[WDW - To be implemented]]] else: @@ -541,7 +616,7 @@ def setMagnifierObjectSize(magProperty, size, updateScreen=True): # [[[JS - Handle only 'crosswire-size' for now]]] if magProperty == 'crosswire-size': - _magnifier.setCrosswireSize(size) + _magnifier.setCrosswireSize(size, ignore_reply=True) Ditto. # [[[WDW - To be implemented]]] else: @@ -603,7 +678,7 @@ def setZoomerMagFactor(x, y, updateScreen=True): - y: The vertical magnification level - updateScreen: Whether or not to update the screen """ - _zoomer.setMagFactor(x, y) + _zoomer.setMagFactor(x, y, ignore_reply=True) Ditto. So.... If you would like to leave the setFoo calls in for now that's fine. But then I'd appreciate it if you could open a new bug and remove them. If you'd like to remove those calls now, that's cool too. Feel free to commit to the master branch after cleaning up the nits. Thanks again and sorry for the delay in getting to this.
(In reply to comment #4) > Review of attachment 190147 [details] [review]: > > Works for me. Thanks! > > A few nits, some more anal-retentive than others. > > + _setROICenter(self.centerX, self.centerY); > > Old habit die hard. :-P (Please drop the semicolon.) Indeed, it is verily a compiled motor reflex of my little finger. (Will drop). > > + rightOfROI = (self.left + self.width + self.edgeMarginX) >= (roiLeft + > roiWidth) > + aboveROI = (self.top - self.edgeMarginY) <= roiTop > + belowROI = (self.top + self.height + self.edgeMarginY) >= (roiTop + > roiHeight) > > Please wrap lines which exceed 80 chars. Right - o. > > +def _dbusCallbackError(funcName, error): > + """Log D-Bus errors > + > + Arguments: > + - funcName: The name of the gsmag function that made the D-Bus call. > + - error: The error that D-Bus returned. > + """ > + logLine = funcName + ' failed: ' + str(error) > + log.info(logLine) > > log.info? Using Orca's debug utilities would be helpful. Which are? A reference to a use elsewhere would probably suffice. Like: "take a look at spam.py and the eggs() function where it uses thingamambob". > > @@ -481,7 +555,7 @@ def setMagnifierCrossHair(enabled, updateScreen=True): > if enabled: > size = settings.magCrossHairSize > > - _magnifier.setCrosswireSize(size) > + _magnifier.setCrosswireSize(size, ignore_reply=True) > _magSettings.set_boolean(CROSSHAIRS_SHOW_KEY, enabled) > > Ok, but... If Orca is no longer going to be controlling the magnifier > preferences, would it make more sense just to remove that call? Yes, it would (will remove, including your other "ditto"'s). > So.... If you would like to leave the setFoo calls in for now that's fine. But > then I'd appreciate it if you could open a new bug and remove them. If you'd > like to remove those calls now, that's cool too. Feel free to commit to the > master branch after cleaning up the nits. > I'd rather just do those removals now. There aren't many.
> Which are? A reference to a use elsewhere would probably suffice. Like: > "take a look at spam.py and the eggs() function where it uses thingamambob". In debug.py. And gsmag.py already uses it. Grep for examples. :-) But if you have questions, lemme know. Thanks!
Created attachment 190604 [details] [review] Patch to make D-Bus calls asynchronous New patch with your suggested fixes. I also removed a lot of dead code that was setting magnifier preferences, since this is now handled by the control center. I checked whether any removed functions were used elsewhere in orca (grep -R <funcName> *), and removed it only if I found no reference to it. Also ran it in a GNOME 3 environment on Fedora 15 and did not detect (1) errors relating to dbus (this bug), nor (2) errors due to the removed code. Still, given all the deletions, it would be great if someone took a second look to see if something is amiss.
Review of attachment 190604 [details] [review]: Looks good to me. Works nicely. And my old saved Orca prefs are no longer stomping on your magnifier's prefs. ;-) Thanks much!!
Comment on attachment 190604 [details] [review] Patch to make D-Bus calls asynchronous http://git.gnome.org/browse/orca/commit/?id=4398c717d8253289de7af1451016d3cf89943a91
< clown> one thing while I remember -- when I tested keyboard focus tracking, all was well except FireFox. Is this a known bug. Joseph, I just tested in Oneiric with Firefox 5. It's working as expected for me. So.... I dunno. If you can give me more specific details and/or a debug.out indicating where the problem might be, I'll investigate further. Thanks again!