Conversation
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.
Contributor
There was a problem hiding this comment.
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+isRunningOnSecureDesktopusage to debounce category changes on secure desktop. - Refactor category-change decision logic into a shared
_shouldDoCategoryChangehelper. - Update
NVDASettingsDialogto 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: |
There was a problem hiding this comment.
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(): |
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.