Skip to content

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

Merged
feerrenrut merged 1 commit into
nvaccess:masterfrom
jcsteh:1passwordInfinite
Apr 17, 2020
Merged

Fix a rare infinite loop in IAccessibleHandler.findGroupboxObject.#11017
feerrenrut merged 1 commit into
nvaccess:masterfrom
jcsteh:1passwordInfinite

Conversation

@jcsteh

@jcsteh jcsteh commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

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 April 16, 2020 02:09
@josephsl

josephsl commented Apr 16, 2020 via email

Copy link
Copy Markdown
Contributor

@jcsteh

jcsteh commented Apr 16, 2020 via email

Copy link
Copy Markdown
Contributor Author

@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 force-pushed the 1passwordInfinite branch from d3e5553 to ced1b1e Compare April 17, 2020 11:11
@jcsteh jcsteh requested review from feerrenrut and removed request for michaelDCurran April 17, 2020 11:13
@feerrenrut feerrenrut merged commit 5e56a64 into nvaccess:master Apr 17, 2020
@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
Copy Markdown
Contributor

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

jcsteh commented Apr 18, 2020 via email

Copy link
Copy Markdown
Contributor Author

@AAClause

AAClause commented Apr 18, 2020

Copy link
Copy Markdown
Contributor

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.

5 participants