Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a rare infinite loop in IAccessibleHandler.findGroupboxObject. #11017

Merged
merged 1 commit into from Apr 17, 2020

Conversation

jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Apr 16, 2020

Link to issue number:

None.

Summary of the issue:

When you open the context menu for 1Password in the system notification area, NVDA freezes.

Description of how this pull request fixes the issue:

This occurs because:

  1. 1Password sets focus to a window which is a child of HWND 65554, widow class "Message". I assume this is some sort of special system message-only window, but I can't find any details.
  2. NVDA walks the focus ancestry, which involves calling IAccessibleHandler.findGroupboxObject on ancestors.
  3. IAccessibleHandler.findGroupboxObject is thus called for this "Message" window.
  4. IAccessibleHandler.findGroupboxObject loops through previous windows, but when you call getPreviousWindow for this window, it returns itself!
  5. And thus an infinite loop ensues.

To work around this, IAccessibleHandler.findGroupboxObject now ensures that the returned previous window is not the same as the window on which it was called.

Testing performed:

Opened the context menu for 1Password in the system notification area. Confirmed that the menu gets focus as expected and that NVDA doesn't freeze.

Known issues with pull request:

None.

Change log entry:

Bug fixes:
- NVDA no longer freezes when you open the context menu for 1Password in the system notification area.

@jcsteh jcsteh requested a review from michaelDCurran Apr 16, 2020
@josephsl
Copy link
Collaborator

josephsl commented Apr 16, 2020

@jcsteh
Copy link
Contributor Author

jcsteh commented Apr 16, 2020

@feerrenrut feerrenrut added the bug label Apr 16, 2020
Previously, when you opened the context menu for 1Password in the system notification area, NVDA froze.
This occurred because:

1. 1Password sets focus to a window which is a child of HWND 65554, widow class "Message".
  I assume this is some sort of special system message-only window, but I can't find any details.
2. NVDA walked the focus ancestry, which involves calling IAccessibleHandler.findGroupboxObject on ancestors.
3. IAccessibleHandler.findGroupboxObject was thus called for this "Message" window.
4. IAccessibleHandler.findGroupboxObject looped through previous windows, but when you call getPreviousWindow for this window, it returns itself!
5. And thus an infinite loop ensues.

To work around this, IAccessibleHandler.findGroupboxObject now ensures that the returned previous window is not the same as the window on which it was called.
@jcsteh jcsteh requested review from feerrenrut and removed request for michaelDCurran Apr 17, 2020
@feerrenrut feerrenrut merged commit 5e56a64 into nvaccess:master Apr 17, 2020
1 check passed
@nvaccessAuto nvaccessAuto added this to the 2020.1 milestone Apr 17, 2020
@feerrenrut feerrenrut modified the milestones: 2020.1, 2020.2 Apr 17, 2020
feerrenrut added a commit that referenced this pull request Apr 17, 2020
@aaclause
Copy link
Contributor

aaclause commented Apr 17, 2020

When you open the context menu for 1Password in the system notification area, NVDA freezes.

This PR doesn't fix this bug for me.

INFO - __main__ (18:21:36.579) - MainThread (7896):
Starting NVDA version alpha-20005,14c2e2ec
[...]
WARNING - watchdog._watcher (18:21:56.368) - watchdog (7452):
Core frozen in stack:
  File "nvda.pyw", line 215, in <module>
  File "core.pyc", line 545, in main
  File "wx\core.pyc", line 2134, in MainLoop
  File "gui\__init__.pyc", line 1032, in Notify
  File "core.pyc", line 515, in run
  File "queueHandler.pyc", line 83, in pumpAll
  File "queueHandler.pyc", line 50, in flushQueue
  File "eventHandler.pyc", line 62, in _queueEventCallback
  File "eventHandler.pyc", line 150, in executeEvent
  File "eventHandler.pyc", line 163, in doPreGainFocus
  File "api.pyc", line 109, in setFocusObject
  File "baseObject.pyc", line 42, in __get__
  File "baseObject.pyc", line 145, in _getPropertyViaCache
  File "NVDAObjects\IAccessible\__init__.pyc", line 1695, in _get_container
  File "IAccessibleHandler\__init__.pyc", line 958, in findGroupboxObject
  File "winUser.pyc", line 490, in getClassName

@jcsteh
Copy link
Contributor Author

jcsteh commented Apr 18, 2020

@aaclause
Copy link
Contributor

aaclause commented Apr 18, 2020

Oh sorry. I've just tested the build alpha-20009,56a62097. And it's perfect! :)
Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants