Skip to content

[two_dimensional_scrollables] Fix TreeView null dereference during paint #9103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tdenniston
Copy link

Collapsing a node when there were other nodes offscreen was causing an unexpected null dereference during painting. This PR fixes the bug and adds a test.

The bug was caused by erroneous computation of the max vertical scroll extent. Previously, the code computed this considering only scroll extent in the trailing (down) direction; it may also be the case that there is a larger scroll extent in the leading (up) direction.

The miscalculation resulted in subsequent error computing the first visible row as a row that is actually offscreen, and thus does not have a render box. The row render box is asserted to be non-null during painting.

Fixes flutter/flutter#149182 and flutter/flutter#164981

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Collapsing a node when there were other nodes offscreen was causing an
unexpected null dereference during painting. This PR fixes the bug and
adds a test.

The bug was caused by erroneous computation of the max vertical scroll
extent. Previously, the code computed this considering only scroll
extent in the trailing (down) direction; it may also be the case that
there is a larger scroll extent in the leading (up) direction.

The miscalculation resulted in subsequent error computing the first
visible row as a row that is actually offscreen, and thus does not have
a render box. The row render box is asserted to be non-null during
painting.

Fixes flutter/flutter#149182 and
flutter/flutter#164981
@tdenniston tdenniston requested a review from Piinks as a code owner April 17, 2025 00:22
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Hey @tdenniston welcome! Thank you for finding and fixing this! Just a small nit to resolve the failing test below:

@tdenniston
Copy link
Author

@Piinks Thanks for the fast review! LMK of other changes, or if I need to squash the commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[two_dimensional_scrollables] TreeView Widget blanks when closing last parent
2 participants