Skip to content

DataGridColumnBorder caching of Freezable brushes is not actually caching anything at all#6714

Merged
dipeshmsft merged 1 commit intodotnet:mainfrom
theficus:main
Oct 26, 2022
Merged

DataGridColumnBorder caching of Freezable brushes is not actually caching anything at all#6714
dipeshmsft merged 1 commit intodotnet:mainfrom
theficus:main

Conversation

@ghost
Copy link

@ghost ghost commented Jun 22, 2022

Fixes #6713

Description

CacheFreezable() logic is incorrect in that it checks if the indexed value is NOT null before caching versus if it IS null. This means that values will never actually be cached and any calls to GetCachedFreezable() will always return null causing the Brush to be regenerated rather than reused on every rendering pass.

Customer Impact

Unnecessary computation on every rendering pass. Possible memory and brush leak.

Regression

Does not appear to be a regression.

Testing

Validated fix locally in private implementation of DataGridColumnBorder

Risk

This should be minimal. DataGridColumnBorder code was clearly implemented assuming that brushes will be cached but they never actually are. There are various assertions in place already to ensure proper behavior here.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost self-requested a review as a code owner June 22, 2022 21:32
@ghost ghost self-assigned this Jun 22, 2022
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 22, 2022
@ghost ghost requested review from SamBent, dipeshmsft and singhashish-wpf June 22, 2022 21:32
@ghost ghost added the Community Contribution A label for all community Contributions label Jun 22, 2022
@singhashish-wpf
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dipeshmsft dipeshmsft added Under Review 📭 waiting-author-feedback To request more information from author. Queue for test pass and removed 📭 waiting-author-feedback To request more information from author. Under Review labels Aug 30, 2022
@dipeshmsft
Copy link
Member

@ameltzerMSFT , thanks for fixing the incorrect caching logic

singhashish-wpf pushed a commit that referenced this pull request Nov 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataGridHeaderBorder.CacheFreezable method does not actually cache freezable brushes

3 participants