Fix Screen Curtain#19305
Merged
Merged
Conversation
Member
Author
|
@michaelDCurran and @seanbudd thoughts on the Known issues with pull request? |
Contributor
|
In case it's useful, #10545 is also an expected scenario where screen curtain fails to initialise. |
0608f52 to
5053369
Compare
Member
Author
|
This also could be argued to fix #10545, as the user is now alerted that screen curtain activation has failed |
seanbudd
approved these changes
Dec 10, 2025
seanbudd
left a comment
Member
There was a problem hiding this comment.
Thanks @SaschaCowley - I think we can close #10545 with this too
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:
Fixes #19263
Closes #10545
Possible fix for #18693 and #18743
Summary of the issue:
Since #19177, if Screen Curtain fails to initialise because
isScreenFullyBlackreturnsFalse, NVDA crashes (#19263).It would appear that from time to time, bitblitting from the desktop context to the capture context in
nvdaHelper/local/screenCurtain.cppfailes due to one or both of the context handles being invalid.I have no idea why this happens, but can only surmise that it's a timing issue, as we check the validity of the contexts upon creation, so something must be invalidating them in the meantime.
I strongly suspect that this is the underlying cause of Screen Curtain failing to be activated on the Windows login screen (#18743) and after login (#18693).
Description of user facing changes:
NVDA no longer crashes if Screen Curtain fails to be enabled when initializing NVDA.
Screen curtain may be enabled more reliably at the login screen and immediately after login.
I have not included a change log entry, because #19263 was introduced as part of 2026.1 alphas, and I don't know if this PR fixes #18693 or #18743.
Description of developer facing changes:
None
Description of development approach:
screenCurtain._screenCurtain.ScreenCurtain.enable, add logic to automatically retry enabling the Screen Curtain a fixed number of times before admitting defeat.If the issue really is a race condition or other timing issue, future retries should theoretically be uneffected by the issue, so it will succeed.
Currently the maximum number of attempts is hardcoded at 3.
screenCurtain._screenCurtain.ScreenCurtain.__init__, wrapself.enablein a try/except block.gui.settingsDialogs.PrivacyAndSecurityDialog._ensureScreenCurtainEnableState, wrapscreenCurtain.screenCurtain.enablein a try/except block, and notify the user when enabling the screen curtain has failed.Testing strategy:
Intentionally introduced errors into
screenCurtain._screenCurtain.ScreenCurtain.enable, and ensure that the error handling works correctly.Intentionally introduced errors that only happen a fixed number of times into
screenCurtain._screenCurtain.ScreenCurtain.enable, and ensure that the retry logic works correctly.Known issues with pull request:
None
Code Review Checklist: