Repository navigation
Conversation
`_DpadDebugOverlayState.build` rounds the focused node's rect for its size label and positions the outline with it. That rect comes from `DpadMarks.rectOf`, which returns whatever the node's global transform maps to — and an ancestor transform can go non-finite for a frame. The framework's stretch-overscroll effect does exactly that while a fling is in flight, so with `debugOverlay: true` the overlay then threw `UnsupportedError: Infinity or NaN toInt` once per frame. `rectOf` now returns null for non-finite geometry (every caller already treats null as "no rect yet"), and the overlay blanks the frame instead of rounding or positioning a non-finite rect: the inspector must never be what takes a frame down. `test/debug_overlay_test.dart` pins the regression — a focused node under a non-finite transform, asserting no exception across the per-frame repaints. It failed with the exact `Infinity or NaN toInt` before these changes. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
debugOverlay: truecan throwUnsupportedError: Infinity or NaN toIntonce per frame, from_DpadDebugOverlayState.build.The overlay rounds the focused node's rect for its
w×hlabel and positions the outline with the same rect. That rect comes fromDpadMarks.rectOf, which returns whatever the node's global transform maps to — and an ancestor transform can be non-finite for a frame. The framework's stretch-overscroll effect does exactly that while a fling is in flight, so the overlay's per-frame repaint reads a non-finite rect for a node that is still legitimately focused.I hit it in a Flutter TV app whose D-pad audit runs as widget tests: overlay on (
debugOverlay: !kReleaseMode), a synthetic fling overscrolls a list mid-sweep, and the overlay then threw once per frame on a route that was otherwise clean.Fix
Two guards, so the inspector can never be the thing that takes a frame down:
DpadMarks.rectOfreturnsnullfor a non-finite rect. Non-finite geometry is not usable geometry, and every caller already treatsnullas "no rect yet" (?? _lastRect,continue, …)._DpadDebugOverlayState.buildalso blanks the frame (SizedBox.shrink()) for a non-finite rect instead of rounding/positioning it.Test
test/debug_overlay_test.dartfocuses a node under a non-finite ancestor transform and asserts no exception across the overlay's per-frame repaints. Before the fix it fails with exactly:flutter analyzeandflutter testare clean on the branch (110 tests).Happy to reshape this if you would rather have the guard in only one of the two places.