Skip to content
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

8344067: TableCell indices may not match the TableRow index #1635

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Maran23
Copy link
Member

@Maran23 Maran23 commented Nov 12, 2024

This PR fixes a bug where the TableCell indices can be outdated (not synchronized) with the TableRow index.

What normally happens is:

  • Index is changed: Cell update is requested when the row is empty (otherwise noop)
  • Item is changed: Cell update is requested, which will now update the indices of the underlying TableCells

Under some circumstances, when a TableRow is reused (e.g. index 60 -> 1) the item can be the same
-> oldIndex != newIndex && oldItem == newItem
This can happen when the items of a TableView are changed, but some items are the same in both item lists (Think about a filter, where we filter down 60 to 2 items).

-> In this scenario, the cell update is not triggered, so the underlying TableCell indices will not be updated ever (e.g. they still have index 60 set, but the row has 1 now).

The fix is to always update the underlying TableCell indices when the TableRow index changed.
While usually the item is different when the index changed, this is not always the case (there is no guarantee that the item changed, as we can see in the example, where the cell is reused).


Also made sure that the issues linked in the code and ticket do not regress:


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8344067: TableCell indices may not match the TableRow index (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1635/head:pull/1635
$ git checkout pull/1635

Update a local copy of the PR:
$ git checkout pull/1635
$ git pull https://git.openjdk.org/jfx.git pull/1635/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1635

View PR using the GUI difftool:
$ git pr show -t 1635

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1635.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 12, 2024

👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 12, 2024

@Maran23 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:

8344067: TableCell indices may not match the TableRow index

Reviewed-by: angorya

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 1 new commit pushed to the master branch:

  • 688f7fa: 8091673: Public focus traversal API for use in custom controls

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Ready for review label Nov 12, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 12, 2024

Webrevs

@Maran23 Maran23 changed the title 8344067: TableCell indices can be outdated with the TableRow index 8344067: TableCell indices may not match the TableRow index Nov 12, 2024
@andy-goryachev-oracle
Copy link
Contributor

I'll review, thanks!

@andy-goryachev-oracle
Copy link
Contributor

The bug is present in TableView and TreeTableView, but not TreeView - is this correct?

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with SCCE found in the ticket on macOS M1 14.7, also some limited testing with the monkey tester, no issues found.

looks good; left some very minor formatting suggestions - will re-approve should you decide to fix.

thanks for writing the tests!

1 reviewer should be enough.

@openjdk openjdk bot added the ready Ready to be integrated label Nov 13, 2024
@Maran23
Copy link
Member Author

Maran23 commented Nov 13, 2024

The bug is present in TableView and TreeTableView, but not TreeView - is this correct?

Yes since ListView and TreeView do not need to do any synchronization when their index or item changed. But I did not test them.

EDIT: Could not reproduce with the ListView or TreeView.

@openjdk openjdk bot removed the ready Ready to be integrated label Nov 13, 2024
@openjdk openjdk bot added the ready Ready to be integrated label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready to be integrated rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants