Skip to content

Register IA2 COM proxy on all Ui threads instead of only the main thread#13542

Merged
seanbudd merged 10 commits into
nvaccess:masterfrom
LeonarddeR:ia2threads
Mar 2, 2023
Merged

Register IA2 COM proxy on all Ui threads instead of only the main thread#13542
seanbudd merged 10 commits into
nvaccess:masterfrom
LeonarddeR:ia2threads

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Mar 26, 2022

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #8553

Summary of the issue:

When an app offers IAccessible2 as its accessibility interface, NVDA needs to install a COM proxy in the UI thread to utilize IA2. However, some apps, particular those that embed Chromium Embedded Controls, have a separate UI thread for the browser control. IAccessible2 and therefore browse mode doesn't work in these controls.

Description of how this pull request fixes the issue:

Register IA COM Proxy in all threads that ever send focus or foreground win events

Testing strategy:

Tested with the Chromium Embedded Framework test case from #13493 (comment)

Known issues with pull request:

This might have performance/stability issues. Therefore an early merge is advised.

Change log entries:

Bug fixes

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@LeonarddeR LeonarddeR requested a review from a team as a code owner March 26, 2022 07:53
@LeonarddeR LeonarddeR requested a review from seanbudd March 26, 2022 07:53
@LeonarddeR

LeonarddeR commented Mar 26, 2022

Copy link
Copy Markdown
Collaborator Author

cc @yolpsoftware @dglee42

@yolpsoftware

Copy link
Copy Markdown

Looking good, thanks. Is that in the next release?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Nope. Note that it is still a prototype. Definitely need feedback from @michaelDCurran on it.

@akash07k

Copy link
Copy Markdown
Contributor

Any test build to try for this PR?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@akash07k

akash07k commented Apr 14, 2022 via email

Copy link
Copy Markdown
Contributor

@seanbudd seanbudd requested review from feerrenrut and removed request for seanbudd June 15, 2022 06:56
@LeonarddeR LeonarddeR marked this pull request as ready for review October 14, 2022 05:51
@LeonarddeR LeonarddeR marked this pull request as draft October 14, 2022 05:51
@yolpsoftware

Copy link
Copy Markdown

@LeonarddeR @michaelDCurran is this abandoned or still work in progress?

@LeonarddeR LeonarddeR marked this pull request as ready for review December 13, 2022 07:15
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Let's mark it ready for review to make it gain some attention. It seems there's demand for it.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 0d9d3e3783

@seanbudd seanbudd requested review from michaelDCurran and seanbudd and removed request for feerrenrut December 21, 2022 00:58

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @LeonarddeR, this is a preliminary review to pick up trivial things.
@michaelDCurran will review the broader approach

Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Hi @LeonarddeR, this is a preliminary review to pick up trivial things. @michaelDCurran will review the broader approach

Thanks for the review. Mind if I wait with review actions until @michaelDCurran's broader approach review is there? Otherwise it's likely that I'll touch code that needs changing anyway.

@michaelDCurran

michaelDCurran commented Dec 22, 2022 via email

Copy link
Copy Markdown
Member

@yolpsoftware

Copy link
Copy Markdown

Any news @michaelDCurran?

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The technical approach looks good to me.
I don't see any concern about not unregistering the winEvent hook once ia2 is installed on a thread. those register / unregister winEventHook functions from nvdaHelper just affect a map and don't handle dll lifetime or anything like that.
The code suggestions from @seanbudd can now be considered / applied at will.

@LeonarddeR LeonarddeR changed the title Prototype: register IA2 COM proxy on all Ui threads instead of only the main thread Register IA2 COM proxy on all Ui threads instead of only the main thread Feb 10, 2023
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 2061177b15

@seanbudd seanbudd marked this pull request as draft February 13, 2023 22:26
@seanbudd seanbudd assigned seanbudd and unassigned michaelDCurran Feb 14, 2023
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 2a20df3386

@yolpsoftware

Copy link
Copy Markdown

Is this ready to merge?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

@yolpsoftware Thanks for the reminder. I guess @seanbudd will have to go over this once again and then it can be merged.

@LeonarddeR LeonarddeR requested a review from seanbudd March 2, 2023 17:17
@LeonarddeR LeonarddeR marked this pull request as ready for review March 2, 2023 17:18
@LeonarddeR LeonarddeR added the merge-early Merge Early in a developer cycle label Mar 2, 2023
@LeonarddeR LeonarddeR added this to the 2023.2 milestone Mar 2, 2023
@seanbudd seanbudd merged commit 6e61640 into nvaccess:master Mar 2, 2023
LeonarddeR added a commit to LeonarddeR/nvda that referenced this pull request Sep 25, 2023
LeonarddeR added a commit to LeonarddeR/nvda that referenced this pull request Sep 25, 2023
seanbudd pushed a commit that referenced this pull request Sep 26, 2023
… itself (#15517)

Fixup of #13542

Summary of the issue:
In #13542, we introduced support for multi thread IA2 initialization. As part of that, the signature of the install- and uninstallIA2Support functions were changed. Somehow, it was an oversight from my end that these functions were also called from NVDAHelper.py. This causes:

NVDA to always log a debug warning on exit, saying that it was unable to unregister IA2 support.
NVDA to call installIA2Initialize without a thread Id. It is actually a miracle that the segfault we're now seeing in preliminary PY3.11 work didn't hurt us earlyer. That said, I think I've seen cases were NVDA played the startup sound and then silently crashed. I think this should be the case.
As per point 2, given the risk of NVDA calling a code path that results in undefined behavior and possible segfaults, I strongly recommend to merge this into beta.

Description of user facing changes
No crashes during NVDA startup.

Description of development approach
Removed the calls from NVDAHelper.py and no longer export the functions from NVDAHelper. The calls in NVDA core were actually obsolete, as IA2 support is registered by injection_initialize and injection_terminate. Note that the install and uninstall IA2 functions aren't called in de 64 bit loader of NVDAHelper, yet IA2 works as expected in X64 applications. Also, installIA2Support is no longer C friendly anyway. Note that an add-on author should never call these functions, therefore I don't consider this as an API breaking change.
@LeonarddeR LeonarddeR deleted the ia2threads branch August 23, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-early Merge Early in a developer cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support embedded Chrome / CEF 3 controls on non-main GUI threads

6 participants