Skip to content

Fix Screen Curtain#19305

Merged
SaschaCowley merged 4 commits into
betafrom
fixScreenCurtain
Dec 10, 2025
Merged

Fix Screen Curtain#19305
SaschaCowley merged 4 commits into
betafrom
fixScreenCurtain

Conversation

@SaschaCowley

@SaschaCowley SaschaCowley commented Nov 30, 2025

Copy link
Copy Markdown
Member

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 isScreenFullyBlack returns False, NVDA crashes (#19263).

It would appear that from time to time, bitblitting from the desktop context to the capture context in nvdaHelper/local/screenCurtain.cpp failes 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:

  • In 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.
  • In screenCurtain._screenCurtain.ScreenCurtain.__init__, wrap self.enable in a try/except block.
  • In gui.settingsDialogs.PrivacyAndSecurityDialog._ensureScreenCurtainEnableState, wrap screenCurtain.screenCurtain.enable in 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:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@SaschaCowley

Copy link
Copy Markdown
Member Author

@michaelDCurran and @seanbudd thoughts on the Known issues with pull request?

@CyrilleB79

Copy link
Copy Markdown
Contributor

In case it's useful, #10545 is also an expected scenario where screen curtain fails to initialise.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Dec 4, 2025
@SaschaCowley SaschaCowley changed the base branch from master to beta December 9, 2025 05:28
@SaschaCowley SaschaCowley marked this pull request as ready for review December 10, 2025 03:15
@SaschaCowley SaschaCowley requested a review from a team as a code owner December 10, 2025 03:15
@SaschaCowley

Copy link
Copy Markdown
Member Author

This also could be argued to fix #10545, as the user is now alerted that screen curtain activation has failed

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @SaschaCowley - I think we can close #10545 with this too

@seanbudd seanbudd added this to the 2026.2 milestone Dec 10, 2025
@SaschaCowley SaschaCowley merged commit 02f3919 into beta Dec 10, 2025
147 of 155 checks passed
@SaschaCowley SaschaCowley deleted the fixScreenCurtain branch December 10, 2025 06:10
@seanbudd seanbudd modified the milestones: 2026.2, 2026.1 Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incidental critical crash on first NVDA launch when screen curtain is on

3 participants