-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Avoid unnecessarty unwwrap of _lastPendingEventTimestamp #121553
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
Conversation
christopherfujino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll defer approval to @dkwingsmt; I have no idea how this code works, I just copy pasted from buganizer to a github issue :)
dkwingsmt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| // ignore: public_member_api_docs | ||
| // | ||
| // Exposed to test for null timestamp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fly-by comment: please don't do this. Anything that is public needs docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ideally, we would find a better way to test this without making it public, if we can't it needs real docs because dartdoc will process it and publish the method to our docs)
|
|
||
| GestureBinding.instance.handleEvent(up90, HitTestEntry(MockHitTestTarget())); | ||
| GestureBinding.instance.handleEvent(up91, HitTestEntry(MockHitTestTarget())); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove one of the blank lines.
| GestureBinding.instance.handleEvent(up91, HitTestEntry(MockHitTestTarget())); | ||
|
|
||
| // Regression test for https://github.com/flutter/flutter/issues/112403. | ||
| v.checkStart(null, down91.pointer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I believe this isn't a full regression test. If someone where to accidentally add the exclamation mark back to line 366 in monodrag.dart (the root cause for the crash), this test would continue to pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just calling acceptGesture twice in a row would trigger this bug.
There seem to be several ways that the last event can get nulled out and not reset depending on which sequence of pointer events get submitted. I don't know which of those would be expected or not and which we should have better test coverage of.
| @visibleForTesting | ||
| void checkStart(Duration? timestamp, int pointer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation is off
| GestureBinding.instance.handleEvent(up90, HitTestEntry(MockHitTestTarget())); | ||
| GestureBinding.instance.handleEvent(up91, HitTestEntry(MockHitTestTarget())); | ||
|
|
||
| // Regression test for https://github.com/flutter/flutter/issues/112403. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we don't need tests like this for null safety, it's considered "code refactor with no semantic change".
#114111 (comment)
refactors with no semantic change (e.g. null safety migrations)
However I believe @dkwingsmt's point in the last PR was: do we understand why is this null #117551 (comment) ? If it's just a mistake from the null migration then this test can be removed. However if it's a legitimate state to be in, can we exercise that state in a unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I do not understand why this is null. I responded to an internal request for a 1p customer who had their pr closed because of a lack of tests. When I saw the pr was a null check crash and they were seeing this happen in the field I thought that it was worth timeboxing writing a test that triggers a null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone else is welcome to take this pr over if they would like.
|
Closing this pr I allocated a small timebox and I am past the effort I decided to spend. |
Takeover of /pull/117551
This fixes /issues/112403 and b/249091367
_lastPendingEventTimestampwhich sometimes causes "Null check operator used on a null"Pre-launch Checklist
///).