Skip to content

beta to master#19777

Merged
seanbudd merged 1 commit intomasterfrom
beta
Mar 11, 2026
Merged

beta to master#19777
seanbudd merged 1 commit intomasterfrom
beta

Conversation

@seanbudd
Copy link
Copy Markdown
Member

No description provided.

Fixes #19634 

### Summary of the issue:
Windows throws errors when rapidly requesting a window handle on the
secure desktop.
This cause visual tearing and a crash of NVDA.

### Description of user facing changes:

Avoid crash and tearing of controls

### Description of developer facing changes:

Add custom handling of changing settings categories for secure mode.

### Description of development approach:
This pull request introduces a debounced category change mechanism in
the `NVDASettingsDialog` to improve stability and user experience,
particularly when running on a secure desktop.

* Added a debounce mechanism (50ms delay) for handling category changes
in `NVDASettingsDialog` when running on a secure desktop, using a timer
to prevent rapid or duplicate category switches. This helps avoid
potential issues with UI responsiveness or event handling in secure
desktop environments.
[[1]](diffhunk://#diff-6486e3db41b2272c03b84758b460cc4269d5ca218874391f58633f5d9b3968b1R6131-R6133)
[[2]](diffhunk://#diff-6486e3db41b2272c03b84758b460cc4269d5ca218874391f58633f5d9b3968b1L6193-R6234)
* Introduced the use of `isRunningOnSecureDesktop` from `utils.security`
to determine when to apply the debounce logic.
* Added type annotations to the `onCategoryChange` method and new
internal variables for better code clarity and maintainability.
[[1]](diffhunk://#diff-6486e3db41b2272c03b84758b460cc4269d5ca218874391f58633f5d9b3968b1L748-R749)
[[2]](diffhunk://#diff-6486e3db41b2272c03b84758b460cc4269d5ca218874391f58633f5d9b3968b1R6131-R6133)
* Ensured proper cleanup of the debounce timer and related state in the
`Destroy` method to prevent resource leaks.

An alternative approach with error suppression was tried, but visual
tearing still occurred.
https://github.com/nvaccess/nvda/compare/try-gui-crash-2?expand=1

### Testing strategy:
Tested STR in #19634 

### Known issues with pull request:

Other instances may exist of rapidly requesting a window handle.
Should this be reported to wxWidgets or microsoft?
Should we create a generic monkey patch or something?
From basic investigating, the only real way to cause this could be
through updating controls in the settings dialog, or the config profiles
dialog.
@seanbudd seanbudd requested a review from a team as a code owner March 11, 2026 04:03
@seanbudd seanbudd merged commit be350b0 into master Mar 11, 2026
46 of 47 checks passed
@github-actions github-actions Bot added this to the 2026.2 milestone Mar 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the NVDA settings dialog category-switching logic to reduce issues when rapidly changing categories on the secure desktop (Winlogon), by debouncing category changes.

Changes:

  • Add debounceLimiter + isRunningOnSecureDesktop usage to debounce category changes on secure desktop.
  • Refactor category-change decision logic into a shared _shouldDoCategoryChange helper.
  • Update NVDASettingsDialog to perform _doOnCategoryChange() only when an actual category change occurs (and to clear pending state on destroy).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self._onCategoryChangeDebounced()
return
super().onCategoryChange(evt)
if evt.Skipped:
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

evt.Skipped is not part of the standard wxPython event API (typically evt.GetSkipped() is used). As written, this risks an AttributeError at runtime and would prevent category changes from working. Please use the supported getter to check whether super().onCategoryChange called evt.Skip().

Suggested change
if evt.Skipped:
if evt.GetSkipped():

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants