Skip to content

Conversation

@jason-simmons
Copy link
Member

If the size is empty, then _updatePaintData will produce an invalid transform
that yields a NaN canvas bounds rectangle

Fixes #7431

@jason-simmons
Copy link
Member Author

@abarth

@abarth
Copy link
Contributor

abarth commented Jan 13, 2017

LGTM

@abarth
Copy link
Contributor

abarth commented Jan 13, 2017

Test?

@abarth
Copy link
Contributor

abarth commented Jan 13, 2017

You can build it with a custom painter inside and check that hte custom painter doesn't paint.

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right. Surely if the size is empty you're more likely to have overflow.

Copy link
Contributor

Choose a reason for hiding this comment

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

In particular I suspect this will break localToGlobal for things inside a zero-size RenderFittedBox.

Copy link
Contributor

Choose a reason for hiding this comment

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

We skip painting the child entirely, so there's no chance of visual overflow.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true. Maybe we should skip this part of the change and only to the part in the paint function.

If the size is empty, then _updatePaintData will produce an invalid transform
that yields a NaN canvas bounds rectangle

Fixes flutter#7431
@jason-simmons
Copy link
Member Author

Removed the change to _updatePaintData and added a test

@abarth
Copy link
Contributor

abarth commented Jan 13, 2017

LGTM

@jason-simmons jason-simmons merged commit 3b70244 into flutter:master Jan 13, 2017
liyuqian added a commit to liyuqian/flutter that referenced this pull request May 3, 2019
Update the test accordingly

See flutter#7489 and flutter#7431 for the original purpose of the test.
liyuqian added a commit that referenced this pull request May 10, 2019
## Description

These will help identify where the matrix starts to get wrong. 

Also fixed `RenderFittexBox` to no longer paint with empty child which previously triggered invalid matrix computations (NaN with dividing by 0). See also #7489

## Related Issues

#31650
#31700
#7431

## Tests

* RenderFittedBox does not paint with empty sizes
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An assert in a flutter app can hang the engine

4 participants