Skip to content

Clear IA2InstallMap when terminating IA2 support.#20291

Draft
jcsteh wants to merge 1 commit into
nvaccess:masterfrom
jcsteh:clearIa2
Draft

Clear IA2InstallMap when terminating IA2 support.#20291
jcsteh wants to merge 1 commit into
nvaccess:masterfrom
jcsteh:clearIa2

Conversation

@jcsteh
Copy link
Copy Markdown
Contributor

@jcsteh jcsteh commented Jun 5, 2026

Link to issue number:

Fixes #15862. Fixes #16020.
Possibly fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1980754 and https://bugzilla.mozilla.org/show_bug.cgi?id=2013244.

Summary of the issue:

Previously, when we terminated IA2 support, we didn't clear the map containing install data (IA2InstallMap). This could cause problems when restarting NVDA if the dll didn't unload before the new copy of NVDA injected. In this case, the same instance of the dll would be used, including its global variables, which includes IA2InstallMap. This caused several problems:

  1. IA2Support_inProcess_initialize refuses to install IA2 if the map contains data. That could result in certain IA2 interface proxies becoming unregistered, causing problems like NVDA plays error sounds and stays silent when using table navigation commands in Firefox after some time #15862 (broken table navigation), Text editing suddenly becomes broken until NVDA restart #16020 (broken rich text editing) and broken native app selection mode.
  2. IA2Support_inProcess_terminate tried to clean up using IA2InstallMap, even if IA2Support_inProcess_initialize refused to run because IA2InstallMap was populated by a previous instance of NVDA. That is, IA2Support_inProcess_terminate could run twice (or more!) with the same map data. This is particularly nasty because the map contains uiThreadHandle set by the installation code, which is closed by IA2Support_inProcess_terminate. That means we could be closing a handle which has been reused by something else; i.e. closing someone else's handle. This likely explains the handle related crashes correlated to the presence of NVDA seen in Firefox bugs 1980754 and 2013244.

Description of user facing changes:

Description of development approach:

Simply clear IA2InstallMap in IA2Support_inProcess_terminate. I also added comments to IA2Support_inProcess_initialize to explain why we can't simply treat the map already containing data as an error.

Testing strategy:

This issue is very difficult to reproduce reliably, so I ran a try build with this fix and asked several other users experiencing this problem to do the same.

Known issues with pull request:

None. Even if this turned out not to fix the problem, this is still more correct.

Code Review Checklist:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant