Skip to content

Fix WindowFromAccessibleObject#18942

Merged
seanbudd merged 2 commits into
nvaccess:masterfrom
LeonarddeR:fixOleacc
Sep 19, 2025
Merged

Fix WindowFromAccessibleObject#18942
seanbudd merged 2 commits into
nvaccess:masterfrom
LeonarddeR:fixOleacc

Conversation

@LeonarddeR
Copy link
Copy Markdown
Collaborator

@LeonarddeR LeonarddeR commented Sep 17, 2025

Link to issue number:

Fixes #18871 

Summary of the issue:

During the winBindings conversion of oleacc, there was an oversight in passing the right argument type to WindowFromAccessibleObject.

Description of user facing changes:

#18871 no longer reproducible

Description of developer facing changes:

None

Description of development approach:

  1. Pass a HWND instead of a c_int to WindowFromAccessibleObject
  2. WindowFromAccessibleObject is only expected to throw a Windows Error. Change the bare except accordingly and also log a debug warning.

Testing strategy:

STR from #18871 

Known issues with pull request:

None known

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.

@LeonarddeR LeonarddeR requested a review from a team as a code owner September 17, 2025 07:56
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 fixes an issue with the WindowFromAccessibleObject function that was introduced during the winBindings conversion of oleacc. The fix ensures proper argument types are passed to the Windows API and improves error handling.

  • Fixed incorrect argument type from c_int to HWND for WindowFromAccessibleObject
  • Improved error handling by catching specific WindowsError instead of bare except
  • Added debug logging for error cases and corrected a spelling error in documentation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
source/oleacc.py Fixed argument type from c_int to HWND, added fallback return value, and corrected spelling
source/IAccessibleHandler/init.py Replaced bare except with specific WindowsError handling and added debug logging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread source/oleacc.py
Comment thread source/oleacc.py Outdated
@SaschaCowley SaschaCowley added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Sep 18, 2025
Copy link
Copy Markdown
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

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

Thanks @LeonarddeR

@seanbudd seanbudd merged commit aa2ae6d into nvaccess:master Sep 19, 2025
40 checks passed
@github-actions github-actions Bot added this to the 2026.1 milestone Sep 19, 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.

Slow focus and error in SQL Server management Studio on recent Alpha builds

4 participants