Skip to content

[A11y] Initialize and copy _blockRange in UIA Clone#10544

Merged
2 commits merged into
mainfrom
dev/cazamor/a11y/bugfix-word-boundary
Jul 6, 2021
Merged

[A11y] Initialize and copy _blockRange in UIA Clone#10544
2 commits merged into
mainfrom
dev/cazamor/a11y/bugfix-word-boundary

Conversation

@carlos-zamora

@carlos-zamora carlos-zamora commented Jul 1, 2021

Copy link
Copy Markdown
Member

Summary of the Pull Request

#7960 was caused by UiaTextRangeBase::_blockRange not being initialized, thus pointing to random memory. In most cases, we initialize it properly in RuntimeClassInitialize, however, the copying version of RuntimeClassInitialize doesn't actually copy it over, resulting in it still containing random memory.

NVDA (and other screen readers) occasionally use Clone (really just the copy initializer), resulting in this bug occurring randomly.

PR Checklist

Validation Steps Performed

Test failed before the change, but passes after the change.

@ghost ghost added Area-Accessibility Issues related to accessibility Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. labels Jul 1, 2021
@carlos-zamora carlos-zamora requested a review from DHowett July 1, 2021 23:59
Comment thread src/types/UiaTextRangeBase.hpp Outdated
@DHowett

DHowett commented Jul 2, 2021

Copy link
Copy Markdown
Member

Careful with the terminology. RuntimeClassInitialize isn't actually a "constructor" in the C++ sense specifically!

@carlos-zamora

Copy link
Copy Markdown
Member Author

Careful with the terminology. RuntimeClassInitialize isn't actually a "constructor" in the C++ sense specifically!

Fixed!

@lhecker lhecker 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.

When Resharper comes out for VS 2022, we should all buy it together.
It has a clang-tidy integration that actually works. 😐

Comment thread src/types/UiaTextRangeBase.hpp Outdated
Comment thread src/types/UiaTextRangeBase.hpp Outdated

@miniksa miniksa 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.

Waiting for pending comments to be complete.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 6, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 6, 2021
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 6, 2021
@ghost

ghost commented Jul 6, 2021

Copy link
Copy Markdown

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 79a18f0 into main Jul 6, 2021
@ghost ghost deleted the dev/cazamor/a11y/bugfix-word-boundary branch July 6, 2021 20:54
DHowett pushed a commit that referenced this pull request Jul 7, 2021
## Summary of the Pull Request
#7960 was caused by `UiaTextRangeBase::_blockRange` not being initialized, thus pointing to random memory. In most cases, we initialize it properly in `RuntimeClassInitialize`, however, the copying version of `RuntimeClassInitialize` doesn't actually copy it over, resulting in it still containing random memory.

NVDA (and other screen readers) occasionally use `Clone` (really just the copy initializer), resulting in this bug occurring randomly.

## PR Checklist
* [X] Closes #7960
* [X] Tests added/passed

## Validation Steps Performed
Test failed before the change, but passes after the change.

(cherry picked from commit 79a18f0)
DHowett pushed a commit that referenced this pull request Jul 7, 2021
## Summary of the Pull Request
#7960 was caused by `UiaTextRangeBase::_blockRange` not being initialized, thus pointing to random memory. In most cases, we initialize it properly in `RuntimeClassInitialize`, however, the copying version of `RuntimeClassInitialize` doesn't actually copy it over, resulting in it still containing random memory.

NVDA (and other screen readers) occasionally use `Clone` (really just the copy initializer), resulting in this bug occurring randomly.

## PR Checklist
* [X] Closes #7960
* [X] Tests added/passed

## Validation Steps Performed
Test failed before the change, but passes after the change.

(cherry picked from commit 79a18f0)
@ghost

ghost commented Jul 14, 2021

Copy link
Copy Markdown

🎉Windows Terminal v1.9.1942.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost ghost mentioned this pull request Jul 14, 2021
@ghost

ghost commented Jul 14, 2021

Copy link
Copy Markdown

🎉Windows Terminal Preview v1.10.1933.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Accessibility Issues related to accessibility AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UIA: incorrect word boundary

4 participants