Bug 671580

Summary: Orca flat review mode not working.
Product: [Mono] UI Automation Reporter: Michał Zegan <webczat_200>
Component: Winforms - GeneralAssignee: E-mail List <mono-a11y-bugs>
Status: NEW --- QA Contact: E-mail List <mono-a11y-qa>
Severity: Major    
Priority: P5 - None CC: mgorse
Version: Release 2.0   
Target Milestone: ---   
Hardware: x86-64   
OS: Linux   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Patch to fix some Orca issues

Description Michał Zegan 2011-02-13 19:51:46 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101106 Gentoo Firefox/3.6.12

I have a problem.
Gentoo does not have any overlay or in-portage package with uia or it's modules.
I've installed automation-ui-2.1 from the source code, along with the winforms uia and atk bridge and dbus module, as you described in the mono accessibility page.
I use mono version 2.8, at-spi version 1, atk version 1.30.
My problem is that if I start the mono program using winforms, i get the warning about bonobo not being initialized, then the window appears.
And I am unable to use flat review, orca does not see any controls or anything, like an empty window.
When I close the window, it's often the case that when I'll be dropped to another window than the one I started the program from, I mean when I close the program window, then when I'll switch back to the terminal, orca hanks.
The strange thing is that there's sometimes the case where I try to run the program, window appears and it properly reads at least one control, also in those cases, I see a message like "unable to set x locale" above the bonobo warning.
But it still does not read everything.
I tried this before without installing uiadbus, and I had an error about dbus not being installed, the bonobo warning appeared, window appeared and it was the same, like empty window.
An exception is that it was never the case that it read any control using flat review.
It all works properly without any error under ubuntu-10.04 and it's uiautomation version.

Reproducible: Always

Steps to Reproduce:
It's really hard to write how to reproduce that.
Actual Results:  
If uiadbus is not installed, program runs with a bonobo warning and orca does not read any control with a flat review.
If uiadbus is installed, orca sometimes reads at least one control, sometimes it does not, if it does, the locale error appears.
Also in this case, it sometimes happens that orca hanks after closing the program's main window and switching to a terminal used to run it, it never happens if I ctrl+c from a terminal.

Expected Results:  
It should all work, I should be able to navigate through all controls of my program using both focus moving by keyboard/tab key and by the orca's flat review.

The program I was testing was something like a two-label hello world, but actually other programs didn't work too.
Comment 1 Michał Zegan 2011-02-13 20:07:10 UTC
(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12)
> Gecko/20101106 Gentoo Firefox/3.6.12
> 
> I have a problem.
> Gentoo does not have any overlay or in-portage package with uia or it's
> modules.
> I've installed automation-ui-2.1 from the source code, along with the winforms
> uia and atk bridge and dbus module, as you described in the mono accessibility
> page.
> I use mono version 2.8, at-spi version 1, atk version 1.30.
> My problem is that if I start the mono program using winforms, i get the
> warning about bonobo not being initialized, then the window appears.
> And I am unable to use flat review, orca does not see any controls or anything,
> like an empty window.
> When I close the window, it's often the case that when I'll be dropped to
> another window than the one I started the program from, I mean when I close the
> program window, then when I'll switch back to the terminal, orca hanks.
> The strange thing is that there's sometimes the case where I try to run the
> program, window appears and it properly reads at least one control, also in
> those cases, I see a message like "unable to set x locale" above the bonobo
> warning.
> But it still does not read everything.
> I tried this before without installing uiadbus, and I had an error about dbus
> not being installed, the bonobo warning appeared, window appeared and it was
> the same, like empty window.
> An exception is that it was never the case that it read any control using flat
> review.
> It all works properly without any error under ubuntu-10.04 and it's
> uiautomation version.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> It's really hard to write how to reproduce that.
> Actual Results:  
> If uiadbus is not installed, program runs with a bonobo warning and orca does
> not read any control with a flat review.
> If uiadbus is installed, orca sometimes reads at least one control, sometimes
> it does not, if it does, the locale error appears.
> Also in this case, it sometimes happens that orca hanks after closing the
> program's main window and switching to a terminal used to run it, it never
> happens if I ctrl+c from a terminal.
> 
> Expected Results:  
> It should all work, I should be able to navigate through all controls of my
> program using both focus moving by keyboard/tab key and by the orca's flat
> review.
> 
> The program I was testing was something like a two-label hello world, but
> actually other programs didn't work too.

Also, I often see errors, for example while closing the window: they say something like: (I can't paste them)
UIADbusBridge.RaiseAutomationEvent inconsistent provider -> wrapper mapping state.
Comment 2 Michael Gorse 2011-02-14 05:27:10 UTC
I can't reproduce this; at least not with my current configuration (which is undoubtedly somehow different from yours).

It's interesting that you're getting an error from Bonobo.  Could you run mono under gdb and figure out where it is being triggered?  Ie, you should be able to break on g_log.

You can get the UIA code to be more verbose by setting MONO_UIA_LOG_LEVEL to 0 in your environment.  Perhaps that will show something.

Also, which version of gtk-sharp are you using?

Fyi, the UiaDbus code is used to expose information to UIA clients; it has no bearing on AT-SPI clients such as Orca.
Comment 3 Michael Gorse 2011-02-14 05:35:41 UTC
Also, when you try to use flat review to, say, read the current line, does orca say "blank," or is it silent?  And does pressing a key otherwise cause the application to lock up?
Comment 4 Michał Zegan 2011-02-15 18:07:27 UTC
I cannot currently have access to the computer where this bug occurs, I'll check when possible.
About flat review, it says "blank".
Comment 5 Michael Gorse 2011-02-16 14:54:42 UTC
Also, a debug.out from Orca might be useful.  See http://live.gnome.org/Orca/Debugging if you need instructions for generating one.
Comment 6 Michał Zegan 2011-02-27 10:21:29 UTC
Okay, I cannot debug mono with gdb.
About using verbose mode, it works and I get the bonobo warning after "about to start main loop" or something.
The error is too large for me to read it.
Comment 7 Michael Gorse 2011-03-01 02:25:18 UTC
I've set up a Gentoo installation, and now I'm having trouble with flat review.  Orca is seeing the state-changed event and then prints a message saying that it can't find the top-level object.  This may be related.  It walks up the tree looking for an object with a role of ROLE_APPLICATION, but the application object is returning ROLE_UNKNOWN.  It might be related to the fix for BNC#515507, since the role setting is now done in a GLib.Timeout as are state-changed events, but I don't understand what is going on yet.
Comment 8 Michael Gorse 2011-03-02 15:16:34 UTC
Created attachment 417085 [details]
Patch to fix some Orca issues

This patch helps with flat review for me.  I think that the following sequence of events were happening:

- The top-level window set its name.  Atk fires an object:property-change:accessible-name event.
- Orca sees the event and queries the object's role.
- AT-SPI1 caches the role.
- The top-level window now set its role.  Atk does not fire a property-change event because the role was initially unknown, so atk considers it part of the initialization.  However, AT-SPI has the role cached as ROLE_UNKNOWN and doesn't re-check the role or update its cache because there was no event.
- An object gets the focus, and Orca gets confused because it expects a top-level object with ROLE_APPLICATION, but AT-SPI thinks that the top-level object still has ROLE_UNKNOWN.

So, to summarize, setting the name before the role is a bad idea.

I'm not seeing a hang or the Bonobo error even with my Gentoo setup, although I'm using git head (I couldn't get 2.1 to build with Mono 2.8; we need to make a new release).

What is the problem you're having running Mono under gdb?  Take a look at http://www.mono-project.com/Debugging; in particular, you should have the following in your .gdbinit; otherwise you'll get interrupted from signals that Mono's garbage collector uses internally:

handle SIGXCPU nostop noprint
handle SIGPWR nostop noprint
handle SIG35 nostop noprint

I think that the "inconsistent provider -> adapter mapping state" errors are unrelated, although I plan to look into them.