-
Notifications
You must be signed in to change notification settings - Fork 451
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
8303680 Virtual Flow freezes after calling scrollTo and scrollPixels in succession #1052
8303680 Virtual Flow freezes after calling scrollTo and scrollPixels in succession #1052
Conversation
Possible fix for VirtualFlow freeze
updated test name
👋 Welcome back fkirmaier! A progress list of the required criteria for merging this PR into |
You will need to modify the title of this PR to match the JBS bug title (which I slightly modified to change "crashed" to "freezes" to better reflect the problem). /reviewers 2 |
@kevinrushforth |
|
||
// scroll to 50 and scroll 1 pixel | ||
vf.scrollTo(50); | ||
vf.scrollPixels(1); |
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.
this is a rather artificial test.
is it possible to reproduce the condition using control's public APIs?
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.
This is the public API of VirtualFlow. I don't know whether it's possible with the API of the Control - But the API of the VirtualFlow should be stable too, right?
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.
You are right, it is public API. One can't get directly to it, but it is possible to subclass the ListView and use the protected getVirtualFlow()
method.
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.
We have many tests that access VirtualFlow, so that seems ok.
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.
would it be possible to update the JBS ticket with a valid code example?
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.
That would be very helpful.
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.
Oh, I didn't notice that I did upload the wrong file.
I've now uploaded the correct test application!
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 let others do the formal review of this, but I would like to see an evaluation of what the root cause is, why this is the right fix, and whether there are any side effects. As it is, all I see is a removed line with no explanation of the problem or the solution.
|
||
// scroll to 50 and scroll 1 pixel | ||
vf.scrollTo(50); | ||
vf.scrollPixels(1); |
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.
We have many tests that access VirtualFlow, so that seems ok.
@@ -1715,7 +1715,6 @@ public double scrollPixels(final double delta) { | |||
|
|||
// Finally, update the scroll bars | |||
updateScrollBarsAndCells(false); | |||
lastPosition = getPosition(); |
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.
This is not a formal review -- I'll let Andy and Johan do that -- but can you explain why this is the right fix? Presumably there was at least some reasoning behind updating lastPosition
. Are there any side effects of not doing that?
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've written more about the explanation below. Actually, it's a good question whether there is reasoning behind updating lastPosition. Wouldn't be surprised, if it is just an artifact of some bug-fixing attempt.
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 review this.
One of the challenges with the VirtualFlow class is that there are a number of parameters that contain some state, and the behavior depends very often on what parameters are modified in which method, and when (in which order).
Some explanation: The layout method contains logic, to skip the layouting.
So, when the position is changed, then the content should be layout again. So I removed the resetting of the lastPosition in the scrollPixels method. But I have to admit, that I don't understand the class well enough to ensure this is correct based on logic. This fixes the unit test and doesn't seem to break tests or something obvious in applications according to my tests. |
Just curious…based on the explanation above about change/not changes, does the call to getPosition help in the case state may (or may not) have changed to ensure there is no stale state at that time? |
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.
Tested this fix with the MonkeyTester app on Macos Ventura 13.1
https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/monkey/MonkeyTesterApp.java
Could not see any ill effects - navigation works, selection works, variable height cells work.
The patch looks ok, and the test fails before and passes after. No regression is observed. Also, the explanation about the changed position outside the layout process makes sense. I'm approving this, as the removal of this line is in line with the general approach here where we don't change the lastXXX properties outside the layout process -- as Florian mentioned as well. |
@FlorianKirmaier This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @andy-goryachev-oracle, @johanvos) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/integrate |
@FlorianKirmaier |
/sponsor |
@FlorianKirmaier |
Going to push as commit 6be8703.
Your commit was automatically rebased without conflicts. |
@andy-goryachev-oracle @FlorianKirmaier Pushed as commit 6be8703. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Possible fix for VirtualFlow freeze.
I encountered the problem when experimenting with VirtualFlow.
Guess @johanvos should take a look.
All tests are still green, so with some luck, this doesn't break anything but fixes some known and unknown bugs.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/1052/head:pull/1052
$ git checkout pull/1052
Update a local copy of the PR:
$ git checkout pull/1052
$ git pull https://git.openjdk.org/jfx pull/1052/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1052
View PR using the GUI difftool:
$ git pr show -t 1052
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1052.diff