On Mon, 6 Mar 2023 16:04:02 GMT, Florian Kirmaier <fkirma...@openjdk.org> wrote:
> 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. > Some explanation: > > The layout method contains logic, to skip the layouting. > > So, when the position is changed, then the content should be layout again. > But when we reset the oldPosition, to the current position, somewhere else in > the code - then we interfere with this logic. This has the effect, that the > layout is skipped. For that reason, it seems wrong to me, to change the > "last-something" values outside of this method. > > So I removed the resetting of the lastPosition in the scrollPixels method. > `lastPosition = getPosition();` I also don't see a reason, why the > lastPosition should be set anyways. > > 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? ------------- PR: https://git.openjdk.org/jfx/pull/1052