UIAHandler: instruct UIA client library to never map winEvents to UIA propertyChange events.#8785
Merged
Merged
Conversation
… propertyChange events.
LeonarddeR
previously approved these changes
Sep 26, 2018
LeonarddeR
left a comment
Collaborator
There was a problem hiding this comment.
Code looks fine to me.
| isUIA8=True | ||
| except (COMError,WindowsError,NameError): | ||
| self.clientObject=CoCreateInstance(CUIAutomation._reg_clsid_,interface=IUIAutomation,clsctx=CLSCTX_INPROC_SERVER) | ||
| # #7345: Instruct UIA to never map MSAA winEvents to UIA propertyChange events. |
Collaborator
There was a problem hiding this comment.
I"m still an advocate of making this configurable with a hidden config parameter, i.e. config.conf['UIA']['unregisterProxyWinEvents']
| # #7345: Instruct UIA to never map MSAA winEvents to UIA propertyChange events. | ||
| # These events are not needed by NVDA, and they can cause the UI Automation client library to become unresponsive if an application firing winEvents has a slow message pump. | ||
| pfm=self.clientObject.proxyFactoryMapping | ||
| for index in xrange(pfm.count): |
Collaborator
There was a problem hiding this comment.
Is the amount of entries in a mapping stable, or can it change while NVDA is running (i.e. can new entries be added for which unregistration has to take place)?
Member
Author
|
As far as I am aware, the list of default proxies come from the
registry, and don't change within the lifetime of a UIA client.
|
This was referenced May 31, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Fixes #7345
Summary of the issue:
Sometimes UI Automation focus events stop firing across the Operating System, if a background app is currently firing a lot of MSAA events and at the same time is slow to respond to window messages. An example would be trying to use File Explorer while another app is showing a progress bar while processing audio.
It was identified that the problems stemmed from UI automation's automatic proxying of MSAA. If an app fired an MSAA winEvent, but then was slow to respond to the WM_GETOBJECT message sent by UI Automation core in order to fetch the MSAA object for proxying to UI Automation, UI Automation core would fail to fire any future focus change events across the entire Operating System.
PR #8742 tried to address this by only registering for UIA property change events for the foreground and its descendants, rather than globally at NVDA launch. However, this caused crashes in File Explorer on recent versions of Windows 10.
Description of how this pull request fixes the issue:
NVDA itself has no use for proxied MSAA objects, as it has its own native support for MSAA, and always uses that if a window does not natively support UI Automation.
However, removing the MSAA proxy all together has the disadvantage of changing the topology of the UI Automation element tree, and in some rare cases, NVDA may still make use of a proxied MSAA object for perhaps a window says its native UI Automation but its implementation is incomplete. (E.g. the tab control in the Windows 10 task manager).
Although we can't remove the proxy all together, we can at least stop the proxy from proxying MSAA winEvents to UI Automation property change events. NVDA never has any use for these property change events as it listens to MSAA winEvents natively.
Therefore, this PR walks through all the registered proxies, and unmaps any MSAA winEvents for the UI Automation property change events NVDA listens to.
Testing performed:
Known issues with pull request:
None known.
Change log entry:
Bug fixes:
NVDA no longer fails to track focus in File Explorer and other applications using UI Automation when another app is busy (such as batch processing audio). (#7345)