Repository navigation
Commit a8346d1
committed
Guard FocusNode.rect/offset/size against an unlaid-out RenderBox
FocusNode.rect and offset read the attached render object's semanticBounds,
which for a RenderBox reads its size. If the render object is attached but has
not completed layout yet (for example a just-mounted Overlay that takes focus
before the layout phase reaches it), this throws 'RenderBox was not laid out',
which crashes the app even in release builds.
Return a zero rect/offset (and therefore zero size) while the box has no size.
The value is corrected on the next frame once layout runs and the focus node is
measured again.
Fixes flutter#191508.1 parent d79b030 commit a8346d1
2 files changed
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
854 | 859 | | |
855 | 860 | | |
856 | 861 | | |
| |||
866 | 871 | | |
867 | 872 | | |
868 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
869 | 879 | | |
870 | 880 | | |
871 | 881 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
115 | 136 | | |
116 | 137 | | |
117 | 138 | | |
| |||
2436 | 2457 | | |
2437 | 2458 | | |
2438 | 2459 | | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
0 commit comments