Clear the braille display on system shutdown - #20646
Merged
Merged
Conversation
seanbudd
reviewed
Aug 13, 2026
seanbudd
approved these changes
Aug 13, 2026
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.
Link to issue number:
Closes https://github.com/nvaccess/nvda/security/advisories/GHSA-qhjv-3xf4-9c66
Follow-up to #18810
Summary of the issue:
When the machine is shut down or restarted with NVDA running and a braille display connected, the display is not reliably updated before NVDA exits. Depending on timing and braille message settings, whatever was last written to the display can remain on it until the display is refreshed or powered off.
Description of user facing changes:
When shutting down or restarting the computer with NVDA running and a braille display connected, the braille display now either shows "Secure Desktop" or is cleared entirely.
Description of developer facing changes:
None.
Description of development approach:
Two changes:
braille.brailleHandler.BrailleHandler._onSecureDesktopStateChanged, callself.update()after clearing the main buffer and before switching to the no-braille fallback. The "Secure Desktop" text is presented as an alert, which is not necessarily written to the display. If it isn't, clearing the buffer has no visible effect until the next display update, and by the time this function returns the display has been freed, so later code can no longer refresh it without re-acquiring it.WM_ENDSESSIONhandler, disable braille (by registering abraille.extensions.decide_enabledhandler that always returnsFalse) and then callbraille.handler._clearAll()if a braille handler exists.In practice step 2 is usually a no-op for me, because the secure desktop state change handler frees the display first, but I don't believe that ordering is guaranteed. To confirm step 2 works on its own, I temporarily removed the session lock and secure desktop state change bindings in
BrailleHandlerand verified theWM_ENDSESSIONpath behaves correctly.Testing strategy:
./scons dist).BrailleHandler's session lock state change and secure desktop state change handlers, rebuilt the dist, ran NVDA and shut down the machine with the power button.Known issues with pull request:
When running from source, the display is not updated on shutdown, as we don't appear to receive
WM_ENDSESSION. I suspect the Python interpreter consumes it and terminates in that case. I don't think this is something we need to worry about.Code Review Checklist: